4 // Copyright (C) 2004 Novell, Inc.
8 // Permission is hereby granted, free of charge, to any person obtaining a
9 // copy of this software and associated documentation files (the "Software"),
10 // to deal in the Software without restriction, including without limitation
11 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 // and/or sell copies of the Software, and to permit persons to whom the
13 // Software is furnished to do so, subject to the following conditions:
15 // The above copyright notice and this permission notice shall be included in
16 // all copies or substantial portions of the Software.
18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24 // DEALINGS IN THE SOFTWARE.
28 using System
.Diagnostics
;
31 using BU
= Beagle
.Util
;
33 namespace Beagle
.Tile
{
35 [HitFlavor (Name
="Music", Rank
=400, Emblem
="emblem-music.png", Color
="#f5f5fe",
36 Type
="File", MimeType
="audio/x-mp3"),
37 HitFlavor (Name
="Music", Rank
=400, Emblem
="emblem-music.png", Color
="#f5f5fe",
38 Type
="File", MimeType
="audio/mpeg"),
39 HitFlavor (Name
="Music", Rank
=400, Emblem
="emblem-music.png", Color
="#f5f5fe",
40 Type
="File", MimeType
="application/ogg"),
41 HitFlavor (Name
="Music", Rank
=400, Emblem
="emblem-music.png", Color
="#f5f5fe",
42 Type
="File", MimeType
="audio/x-flac"),
43 HitFlavor (Name
="Music", Rank
=400, Emblem
="emblem-music.png", Color
="#f5f5fe",
44 Type
="File", MimeType
="video/x-ms-asf")]
46 public class TileMusic
: TileFile
{
47 public TileMusic (Hit _hit
) : base (_hit
,
48 "template-music.html")
52 protected override void PopulateTemplate ()
54 base.PopulateTemplate ();
56 Template
["Title"] = Path
.GetFileName (BU
.UriFu
.LocalPathFromUri (Hit
.Uri
));
57 if (Hit
["fixme:title"] != null && Hit
["fixme:title"].Trim().Length
> 0)
58 Template
["Title"] = Hit
["fixme:title"];
60 Template
["fixme:artist"] = "Unknown Artist";
61 if (Hit
["fixme:artist"] != null && Hit
["fixme:artist"].Trim().Length
> 0)
62 Template
["Artist"] = Hit
["fixme:artist"];
64 Template
["Album"] = "Unknown Album";
65 if (Hit
["fixme:album"] != null && Hit
["fixme:album"].Trim().Length
> 0)
66 Template
["Album"] = Hit
["fixme:album"];
70 public void Enqueue ()
75 protected void EnqueueMedia (Hit hit
)
77 Process p
= new Process ();
78 p
.StartInfo
.UseShellExecute
= false;
79 p
.StartInfo
.FileName
= "totem";
80 p
.StartInfo
.Arguments
= "--enqueue " + hit
.PathQuoted
;
84 } catch (Exception e
) {
85 Console
.WriteLine ("Error in EnqueueMedia: " + e
);