2 * Copyright (C) 2010 Jens Georg.
4 * Author: Jens Georg <mail@jensge.org>
6 * This file is part of Rygel.
8 * Rygel is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU Lesser General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * Rygel is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 public abstract class Rygel.MediaItem : GLib.Object {
27 public class Rygel.AudioItem : MediaItem {}
29 public class Rygel.MusicItem : AudioItem {
34 private class Rygel.AlbumArtSpecTest : GLib.Object {
35 public static int main (string[] args) {
36 var test = new AlbumArtSpecTest ();
44 this.test_full_spec ();
45 //this.test_simple_spec ();
47 /* This is just here to avoid a warning about an unused method: */
48 var thumbnail = new Thumbnail();
49 var didl_writer = new GUPnP.DIDLLiteWriter (null);
50 var didl_item = didl_writer.add_item ();
51 thumbnail.add_resource(didl_item, "http");
54 public void test_full_spec () {
55 var store = MediaArtStore.get_default ();
56 var item = new MusicItem ();
57 item.artist = "metallica";
58 item.album = "and justice for all";
59 item.title = "Enter Sandman";
60 var file = store.get_media_art_file ("album", item);
61 assert (file != null);
62 assert (file.get_uri ().has_suffix
64 "3c2234a7ce973bc1700e0c743d6a819c-" +
65 "3d422ba022ae0daa8f5454ba7dfa0f9a.jpeg"));
67 file = store.get_media_art_file ("artist", item);
68 assert (file != null);
69 assert (file.get_uri ().has_suffix
71 "3c2234a7ce973bc1700e0c743d6a819c-" +
72 "3d422ba022ae0daa8f5454ba7dfa0f9a.jpeg"));
74 item = new MusicItem ();
75 item.title = "radio ga ga";
76 file = store.get_media_art_file ("radio", item);
77 assert (file != null);
78 assert (file.get_uri ().has_suffix
80 "b924ce08955675c6a30c745d18286d21-" +
81 "7215ee9c7d9dc229d2921a40e899ec5f.jpeg"));
83 item = new MusicItem ();
84 item.artist = "met[xXx]allica";
85 item.album = "and justice f[{]}or all";
86 item.title = "Enter Sandman";
87 file = store.get_media_art_file ("album", item);
88 assert (file != null);
89 assert (file.get_uri ().has_suffix
91 "3c2234a7ce973bc1700e0c743d6a819c-" +
92 "3d422ba022ae0daa8f5454ba7dfa0f9a.jpeg"));
94 // check block removal algorithm - normalizes to "metallica" and not
96 item = new MusicItem ();
97 item.artist = "met[xX[x]alli]ca";
98 item.album = "and justice for all";
99 item.title = "Enter Sandman";
100 file = store.get_media_art_file ("album", item);
101 assert (file != null);
102 assert (file.get_uri ().has_suffix
104 "3c2234a7ce973bc1700e0c743d6a819c-" +
105 "3d422ba022ae0daa8f5454ba7dfa0f9a.jpeg"));
107 /* Fails due to unclear spec
108 item = new MusicItem ();
109 item.artist = "World Soccer";
110 item.title = "Daily Podcast";
111 file = store.get_media_art_file ("podcast", item);
112 assert (file != null);
113 assert (file.get_uri ().has_suffix
115 "d717b10ec8fb35b11644995deb04b721-" +
116 "08d299536e562915eb133e2676396d3f.jpeg"));
120 item = new MusicItem ();
121 item.artist = "Peter Fox";
122 item.album = "Stadtaffe";
123 item.title = "Schwarz zu Blau";
124 file = store.get_media_art_file ("album", item, true);
125 assert (file != null);
126 debug (file.get_uri());
127 assert (file.get_uri ().has_suffix
128 ("album-15f9f69ee3d841df6b1e2f56439f11a2.jpg"));