[Pkg-cli-apps-commits] r3819 - /packages/tangerine/trunk/debian/patches/01_new-db4o.patch

slomo at users.alioth.debian.org slomo at users.alioth.debian.org
Wed Mar 19 22:59:03 UTC 2008


Author: slomo
Date: Wed Mar 19 22:59:03 2008
New Revision: 3819

URL: http://svn.debian.org/wsvn/pkg-cli-apps/?sc=1&rev=3819
Log:
* fix patch

Modified:
    packages/tangerine/trunk/debian/patches/01_new-db4o.patch

Modified: packages/tangerine/trunk/debian/patches/01_new-db4o.patch
URL: http://svn.debian.org/wsvn/pkg-cli-apps/packages/tangerine/trunk/debian/patches/01_new-db4o.patch?rev=3819&op=diff
==============================================================================
--- packages/tangerine/trunk/debian/patches/01_new-db4o.patch (original)
+++ packages/tangerine/trunk/debian/patches/01_new-db4o.patch Wed Mar 19 22:59:03 2008
@@ -1,187 +1,3 @@
---- ../../../../build-area/tangerine-0.3.0+dfsg/plugins/file/FilePlugin.cs	2008-03-19 23:45:28.000000000 +0100
-+++ FilePlugin.cs	2008-03-19 23:44:37.000000000 +0100
-@@ -7,11 +7,12 @@
- using Nini;
- using DAAP;
- using log4net;
--using com.db4o;
-+using Db4objects.Db4o;
-+
-+[assembly: Tangerine.Plugin ("file", typeof (Tangerine.Plugins.FilePlugin))]
- 
- namespace Tangerine.Plugins {
- 
--    [Plugin ("file")]
-     public class FilePlugin : IDisposable {
-         private Dictionary<string, Track> trackHash = new Dictionary<string, Track> ();
-         private Dictionary<string, Playlist> playlistHash = new Dictionary<string, Playlist> ();
-@@ -21,7 +22,7 @@
-         private string[] directories;
-         private bool running = true;
- 
--        private ObjectContainer odb;
-+        private IObjectContainer odb;
- 
-         private Server server;
-         private Database db;
-@@ -29,22 +30,24 @@
-         
-         public FilePlugin () {
- 
--#if !WINDOWS
-+#if LINUX || MACOSX
-             string defaultDir = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.Personal), "Music");
--#else
-+            char splitChar = ':';
-+#else
-             string defaultDir = Environment.GetFolderPath (Environment.SpecialFolder.MyMusic);
-+            char splitChar = ';';
- #endif
-             if (Daemon.ConfigSource.Configs["FilePlugin"] == null) {
-                 directories = new string[] { defaultDir };
-             } else {
--                directories = Daemon.ConfigSource.Configs["FilePlugin"].Get ("directories", defaultDir).Split (';');
-+                directories = Daemon.ConfigSource.Configs["FilePlugin"].Get ("directories", defaultDir).Split (splitChar);
-             }
- 
-             server = Daemon.Server;
-             db = Daemon.DefaultDatabase;
-             log = Daemon.Log;
- 
--#if !WINDOWS
-+#if LINUX
-             if (Inotify.Enabled) {
-                 log.Info ("Using inotify to watch for changes");
-             } else {
-@@ -107,11 +110,12 @@
-                 if (!Directory.Exists (Daemon.ConfigDirectory)) {
-                     Directory.CreateDirectory (Daemon.ConfigDirectory);
-                 }
--                
--                odb = Db4o.OpenFile (Path.Combine (Daemon.ConfigDirectory, "tracks.db"));
-+
-+                Db4oFactory.Configure().AllowVersionUpdates (true);
-+                odb = Db4oFactory.OpenFile (Path.Combine (Daemon.ConfigDirectory, "tracks.db"));
-             }
- 
--            ObjectSet result = odb.Get (typeof (Track));
-+            IObjectSet result = odb.Get (typeof (Track));
-             log.DebugFormat ("{0} songs in database", result.Count);
-             
-             foreach (Track song in result) {
-@@ -146,7 +150,7 @@
-                 return;
-             }
- 
--#if !WINDOWS
-+#if LINUX
-             Inotify.Subscribe (dir, OnDirectoryEvent,
-                                Inotify.EventType.CloseWrite | Inotify.EventType.MovedFrom |
-                                Inotify.EventType.MovedTo | Inotify.EventType.Delete | Inotify.EventType.Unmount);
-@@ -176,24 +180,46 @@
-             }
-         }
- 
--        public static void UpdateTrack (Track track, string file) {
-+        public static bool UpdateTrack (Track track, string file) {
-             TagLib.File af;
- 
-+            FileInfo info = new FileInfo (file);
-+            if((int) info.Length >= 0) {
-+                track.Size = (int) info.Length;
-+            } else {
-+                return false;
-+            }
-+
-             try {
-                 af = TagLib.File.Create (file);
--            } catch (Exception e) {
--                return;
-+            } catch {
-+                return false;
-+            }
-+
-+            if(af.Properties.Duration.TotalSeconds >= 1) {
-+                track.Duration = af.Properties.Duration;
-+            } else {
-+                return false;
-             }
- 
--            if (af.Tag.Artists != null && af.Tag.Genres.Length > 0) {
-+            if((short) af.Properties.AudioBitrate >=0) {
-+                track.BitRate = (short) af.Properties.AudioBitrate;
-+            }else{
-+                return false;
-+            }
-+
-+            if (af.Tag.Artists != null && af.Tag.Artists.Length > 0) {
-                 track.Artist = af.Tag.Artists[0];
-             } else {
-                 track.Artist = String.Empty;
-             }
-             
-             track.Album = af.Tag.Album;
--            track.Title = af.Tag.Title;
--            track.Duration = af.AudioProperties.Duration;
-+            if (track.Artist != String.Empty || (af.Tag.Title != null && af.Tag.Title != String.Empty) || (af.Tag.Album != null && af.Tag.Album != String.Empty)) {
-+                track.Title = af.Tag.Title;
-+            } else {
-+                track.Title = info.Name;
-+            }
-             track.FileName = file;
-             track.Format = Path.GetExtension (file).Substring (1);
- 
-@@ -203,31 +229,26 @@
-                 track.Genre = String.Empty;
-             }
-             
--            FileInfo info = new FileInfo (file);
--            track.Size = (int) info.Length;
-             track.TrackCount = (int) af.Tag.TrackCount;
-             track.TrackNumber = (int) af.Tag.Track;
-             track.Year = (int) af.Tag.Year;
--            track.BitRate = (short) af.AudioProperties.Bitrate;
-+
-+            return true;
-         }
- 
-         private void AddTrack (string file) {
-             if (trackHash.ContainsKey (file))
-                 return;
-             
--            Track track;
--
--            if (trackHash.ContainsKey (file)) {
--                track = trackHash[file];
--            } else {
--                track = new Track ();
--                db.AddTrack (track);
-+            Track track = new Track ();
-+            try {
-+                if (UpdateTrack (track, file)) {
-+                    db.AddTrack (track);   
-+                    trackHash[file] = track;
-+                    odb.Set (track);
-+                }
-+            } catch {
-             }
--
--            UpdateTrack (track, file);
--
--            trackHash[file] = track;
--            odb.Set (track);
-         }
- 
-         private void RemoveTrack (string file) {
-@@ -275,7 +296,7 @@
-             playlistHash.Remove (file);
-         }
- 
--#if !WINDOWS
-+#if LINUX
-         private void OnDirectoryEvent (Inotify.Watch watch, string path, string subitem,
-                                        string srcpath, Inotify.EventType type) {
- 
 --- plugins/file/FilePlugin.cs.old	2008-03-19 23:45:55.000000000 +0100
 +++ plugins/file/FilePlugin.cs	2008-03-19 23:47:57.000000000 +0100
 @@ -7,7 +7,7 @@




More information about the Pkg-cli-apps-commits mailing list