• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Sqlite.HyenaSqliteCommand类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Hyena.Data.Sqlite.HyenaSqliteCommand的典型用法代码示例。如果您正苦于以下问题:C# HyenaSqliteCommand类的具体用法?C# HyenaSqliteCommand怎么用?C# HyenaSqliteCommand使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



HyenaSqliteCommand类属于Hyena.Data.Sqlite命名空间,在下文中一共展示了HyenaSqliteCommand类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: PlaylistSource

        static PlaylistSource()
        {
            add_track_range_command = new HyenaSqliteCommand (@"
                INSERT INTO CorePlaylistEntries
                    (EntryID, PlaylistID, TrackID, ViewOrder)
                    SELECT null, ?, ItemID, OrderId + ?
                        FROM CoreCache WHERE ModelID = ?
                        LIMIT ?, ?"
            );

            add_track_command = new HyenaSqliteCommand (@"
                INSERT INTO CorePlaylistEntries
                    (EntryID, PlaylistID, TrackID, ViewOrder)
                    VALUES (null, ?, ?, ?)"
            );

            add_track_range_from_joined_model_sql = @"
                INSERT INTO CorePlaylistEntries
                    (EntryID, PlaylistID, TrackID, ViewOrder)
                    SELECT null, ?, TrackID, OrderId + ?
                        FROM CoreCache c INNER JOIN {0} e ON c.ItemID = e.{1}
                        WHERE ModelID = ?
                        LIMIT ?, ?";

            remove_track_range_command = new HyenaSqliteCommand (@"
                DELETE FROM CorePlaylistEntries WHERE PlaylistID = ? AND
                    EntryID IN (SELECT ItemID FROM CoreCache
                        WHERE ModelID = ? ORDER BY OrderID LIMIT ?, ?)"
            );
        }
开发者ID:dufoli,项目名称:banshee,代码行数:30,代码来源:PlaylistSource.cs


示例2: LyricsDownloadJob

        public LyricsDownloadJob(bool force)
            : base(AddinManager.CurrentLocalizer.GetString ("Downloading Lyrics"))
        {
            PriorityHints = PriorityHints.LongRunning;
            IsBackground = true;
            CanCancel = true;
            DelayShow = true;
            SetResources (Resource.Database);

            if (force) {
                /*remove from Lyrics Downloads trakcs without lyrics */
                ServiceManager.DbConnection.Execute (new HyenaSqliteCommand (@"
                DELETE FROM LyricsDownloads WHERE Downloaded = 0"));
            }

            SelectCommand = new HyenaSqliteCommand (@"
                SELECT CoreTracks.TrackID, CoreArtists.Name, CoreTracks.Title, CoreTracks.Uri
                    FROM CoreTracks, CoreArtists
                    WHERE
                        CoreTracks.PrimarySourceID = ? AND
                        CoreTracks.ArtistID = CoreArtists.ArtistID AND
                        CoreTracks.TrackID NOT IN (
                            SELECT TrackID from LyricsDownloads) LIMIT 1",
            ServiceManager.SourceManager.MusicLibrary.DbId);

            CountCommand = new HyenaSqliteCommand (@"
                SELECT count(CoreTracks.TrackID)
                    FROM CoreTracks
                    WHERE
                        CoreTracks.PrimarySourceID = ? AND
                        CoreTracks.TrackID NOT IN (
                            SELECT TrackID from LyricsDownloads)",
            ServiceManager.SourceManager.MusicLibrary.DbId);
        }
开发者ID:nailyk,项目名称:banshee-community-extensions,代码行数:34,代码来源:LyricsDownloadJob.cs


示例3: CreatePlaylist

        private void CreatePlaylist(object o, EventArgs args)
        {
            if (finished) {
                return;
            }

            finished = true;

            try {
                PlaylistSource playlist = new PlaylistSource (name, source);
                playlist.Save ();
                source.AddChildSource (playlist);

                HyenaSqliteCommand insert_command = new HyenaSqliteCommand (String.Format (
                    @"INSERT INTO CorePlaylistEntries (PlaylistID, TrackID) VALUES ({0}, ?)", playlist.DbId));

                //ServiceManager.DbConnection.BeginTransaction ();
                foreach (string uri in uris) {
                    // FIXME: Does the following call work if the source is just a PrimarySource (not LibrarySource)?
                    long track_id = source.GetTrackIdForUri (uri);
                    if (track_id > 0) {
                        ServiceManager.DbConnection.Execute (insert_command, track_id);
                    }
                }

                playlist.Reload ();
                playlist.NotifyUser ();
            } catch (Exception e) {
                Hyena.Log.Exception (e);
            }
        }
开发者ID:dufoli,项目名称:banshee,代码行数:31,代码来源:PlaylistFileUtil.cs


示例4: UpdateUnfilteredAggregates

 public override void UpdateUnfilteredAggregates ()
 {
     HyenaSqliteCommand count_command = new HyenaSqliteCommand (String.Format (
         "SELECT COUNT(*) {0} AND PodcastItems.IsRead = 0", UnfilteredQuery
     ));
     UnfilteredCount = Connection.Query<int> (count_command);
 }
开发者ID:allquixotic,项目名称:banshee-gst-sharp-work,代码行数:7,代码来源:PodcastTrackListModel.cs


示例5: GetRecommendations

        public IEnumerable<RecommendedArtist> GetRecommendations()
        {
            var command = new HyenaSqliteCommand (topArtistsQuery);

            using (IDataReader reader = ServiceManager.DbConnection.Query (command)) {
                while (reader.Read ()) {
                    var artistName = reader.Get<string> (0);
                    var artistMusicBrainzId = reader.Get<string> (1);

                    var artist = new RecommendedArtist (artistName, artistMusicBrainzId);

                    yield return artist;
                }
            }
        }
开发者ID:nailyk,项目名称:banshee-community-extensions,代码行数:15,代码来源:RecommendationProvider.cs


示例6: CoverArtJob

        public CoverArtJob (DateTime lastScan) : base (Catalog.GetString ("Downloading Cover Art"))
        {
            last_scan = lastScan;

            // Since we do last_scan - retry_every, avoid out-of-range error by ensuring
            // the last_scan date isn't already MinValue
            if (last_scan == DateTime.MinValue) {
                last_scan = DateTime.Now - TimeSpan.FromDays (365*50);
            }

            CountCommand = new HyenaSqliteCommand (@"
                SELECT count(DISTINCT CoreTracks.AlbumID)
                    FROM CoreTracks, CoreArtists, CoreAlbums
                    WHERE
                        CoreTracks.PrimarySourceID = ? AND
                        CoreTracks.DateUpdatedStamp > ? AND
                        CoreTracks.AlbumID = CoreAlbums.AlbumID AND
                        CoreAlbums.ArtistID = CoreArtists.ArtistID AND
                        CoreTracks.AlbumID NOT IN (
                            SELECT AlbumID FROM CoverArtDownloads WHERE
                                LastAttempt > ? OR Downloaded = 1)",
                ServiceManager.SourceManager.MusicLibrary.DbId, last_scan, last_scan - retry_every
            );

            SelectCommand = new HyenaSqliteCommand (String.Format (@"
                SELECT DISTINCT CoreAlbums.AlbumID, CoreAlbums.Title, CoreArtists.Name, {0}, CoreTracks.TrackID
                    FROM CoreTracks, CoreArtists, CoreAlbums
                    WHERE
                        CoreTracks.PrimarySourceID = ? AND
                        CoreTracks.DateUpdatedStamp > ? AND
                        CoreTracks.AlbumID = CoreAlbums.AlbumID AND
                        CoreAlbums.ArtistID = CoreArtists.ArtistID AND
                        CoreTracks.AlbumID NOT IN (
                            SELECT AlbumID FROM CoverArtDownloads WHERE
                                LastAttempt > ? OR Downloaded = 1)
                    GROUP BY CoreTracks.AlbumID ORDER BY CoreTracks.DateUpdatedStamp DESC LIMIT ?",
                Banshee.Query.BansheeQuery.UriField.Column),
                ServiceManager.SourceManager.MusicLibrary.DbId, last_scan, last_scan - retry_every, 1
            );

            SetResources (Resource.Database);
            PriorityHints = PriorityHints.LongRunning;

            IsBackground = true;
            CanCancel = true;
            DelayShow = true;
        }
开发者ID:gclark916,项目名称:banshee,代码行数:47,代码来源:CoverArtJob.cs


示例7: CS_TrackInfoDb

        public CS_TrackInfoDb(BansheeDbConnection con)
        {
            _con=con;
            _sql_check=new HyenaSqliteCommand("SELECT COUNT(*) FROM cuesheet_info WHERE key=?");
            _sql_get=new HyenaSqliteCommand("SELECT type,value FROM cuesheet_info WHERE key=?");
            _sql_insert=new HyenaSqliteCommand("INSERT INTO cuesheet_info VALUES(?,?,?)");
            _sql_update=new HyenaSqliteCommand("UPDATE cuesheet_info SET type=?, value=? WHERE key=?");
            _sql_key_begin=new HyenaSqliteCommand("SELECT key FROM cuesheet_info WHERE key LIKE ?");
            try {
                if (!_con.TableExists ("cuesheet_info")) {
                    _con.Query ("CREATE TABLE cuesheet_info(key varchar,type varchar,value varchar)");
                    _con.Query ("CREATE INDEX cuesheet_idx1 ON cuesheet_info(key)");
                }

            } catch (System.Exception ex) {
                Hyena.Log.Information (ex.ToString ());
            }
        }
开发者ID:nailyk,项目名称:banshee-community-extensions,代码行数:18,代码来源:CS_TrackInfoDb.cs


示例8: IdentifiesParameters

        public void IdentifiesParameters ()
        {
            HyenaSqliteCommand cmd = null;
            try {
                cmd = new HyenaSqliteCommand ("select foo from bar where baz = ?, bbz = ?, this = ?",
                    "a", 32);
                Assert.Fail ("Should not have been able to pass 2 values to ApplyValues without exception");
            } catch {}

            try {
                cmd = new HyenaSqliteCommand ("select foo from bar where baz = ?, bbz = ?, this = ?",
                    "a", 32, "22");
            } catch {
                Assert.Fail ("Should have been able to pass 3 values to ApplyValues without exception");
            }

            Assert.AreEqual ("select foo from bar where baz = 'a', bbz = 32, this = '22'", GetGeneratedSql (cmd));
        }
开发者ID:Yetangitu,项目名称:f-spot,代码行数:18,代码来源:SqliteCommandTests.cs


示例9: SaveTrackMetadataJob

        public SaveTrackMetadataJob () : base (Catalog.GetString ("Saving Metadata to File"))
        {
            SetResources (Resource.Cpu, Resource.Disk, Resource.Database);
            IsBackground = true;

            var db_ids = ServiceManager.Get<SaveTrackMetadataService> ().Sources.
                Select (s => s.DbId.ToString ()).ToArray ();

            string range = String.Join (",", db_ids);

            //FIXME: should we add the case in which LastSyncedStamp IS NULL?
            string condition = String.Format (
                @"DateUpdatedStamp > LastSyncedStamp
                  AND PrimarySourceID IN ({0})", range);

            CountCommand = new HyenaSqliteCommand (
                "SELECT COUNT(*) FROM CoreTracks WHERE " + condition);

            SelectCommand = DatabaseTrackInfo.Provider.CreateFetchCommand (condition);
        }
开发者ID:allquixotic,项目名称:banshee-gst-sharp-work,代码行数:20,代码来源:SaveTrackMetadataJob.cs


示例10: ParameterSerialization

        public void ParameterSerialization ()
        {
            HyenaSqliteCommand cmd = new HyenaSqliteCommand ("select foo from bar where baz = ?");

            Assert.AreEqual ("select foo from bar where baz = NULL", GetGeneratedSql (cmd, null));
            Assert.AreEqual ("select foo from bar where baz = 'It''s complicated, \"but\" ''''why not''''?'", GetGeneratedSql (cmd, "It's complicated, \"but\" ''why not''?"));
            Assert.AreEqual ("select foo from bar where baz = 0", GetGeneratedSql (cmd, new DateTime (1970, 1, 1).ToLocalTime ()));
            Assert.AreEqual ("select foo from bar where baz = 931309200", GetGeneratedSql (cmd, new DateTime (1999, 7, 7).ToLocalTime ()));
            Assert.AreEqual ("select foo from bar where baz = 555.55", GetGeneratedSql (cmd, 555.55f));
            Assert.AreEqual ("select foo from bar where baz = 555.55", GetGeneratedSql (cmd, 555.55));
            Assert.AreEqual ("select foo from bar where baz = 555", GetGeneratedSql (cmd, 555));
            Assert.AreEqual ("select foo from bar where baz = 1", GetGeneratedSql (cmd, true));
            Assert.AreEqual ("select foo from bar where baz = 0", GetGeneratedSql (cmd, false));

            HyenaSqliteCommand cmd2 = new HyenaSqliteCommand ("select foo from bar where baz = ?, bar = ?, boo = ?");
            Assert.AreEqual ("select foo from bar where baz = NULL, bar = NULL, boo = 22", GetGeneratedSql (cmd2, null, null, 22));

            HyenaSqliteCommand cmd3 = new HyenaSqliteCommand ("select foo from bar where id in (?) and foo not in (?)");
            Assert.AreEqual ("select foo from bar where id in (1,2,4) and foo not in ('foo','baz')",
                    GetGeneratedSql (cmd3, new int [] {1, 2, 4}, new string [] {"foo", "baz"}));
        }
开发者ID:Yetangitu,项目名称:f-spot,代码行数:21,代码来源:SqliteCommandTests.cs


示例11: SaveTrackMetadataJob

        public SaveTrackMetadataJob () : base (Catalog.GetString ("Saving Metadata to File"))
        {
            SetResources (Resource.Cpu, Resource.Disk, Resource.Database);
            IsBackground = true;

            var db_ids = ServiceManager.Get<SaveTrackMetadataService> ().Sources.
                Select (s => s.DbId.ToString ()).ToArray ();

            string range = String.Join (",", db_ids);

            string condition = String.Format (
                @"(DateUpdatedStamp > LastSyncedStamp OR
                  (DateUpdatedStamp IS NOT NULL AND LastSyncedStamp IS NULL))
                  AND PrimarySourceID IN ({0})
                  AND Uri LIKE '{1}%'", range, "file:");

            CountCommand = new HyenaSqliteCommand (
                "SELECT COUNT(*) FROM CoreTracks WHERE " + condition);

            SelectCommand = DatabaseTrackInfo.Provider.CreateFetchCommand (condition + " LIMIT 1");
        }
开发者ID:mono-soc-2011,项目名称:banshee,代码行数:21,代码来源:SaveTrackMetadataJob.cs


示例12: AlbumArtWriterJob

        public AlbumArtWriterJob(AlbumArtWriterService in_service)
            : base(AddinManager.CurrentLocalizer.GetString ("Saving Cover Art To Album folders"))
        {
            service = in_service;
            CurrentTime = DateTime.Now;
            if ((service != null) && (service.ForceRecopy)){
                TimeOffset = CurrentTime;
            } else {
                TimeOffset = CurrentTime - TimeSpan.FromDays(7);
            }
            CountCommand = new HyenaSqliteCommand (@"
                                SELECT count(DISTINCT CoreTracks.AlbumID)
                                    FROM CoreTracks, CoreAlbums
                                WHERE
                                    CoreTracks.PrimarySourceID = ? AND
                                    CoreTracks.AlbumID = CoreAlbums.AlbumID AND
                                    CoreTracks.AlbumID NOT IN (
                                        SELECT AlbumID from AlbumArtWriter WHERE
                                        SavedOrTried > 0 AND LastUpdated >= ?)"
                , ServiceManager.SourceManager.MusicLibrary.DbId, TimeOffset);

            SelectCommand = new HyenaSqliteCommand (@"
                                SELECT DISTINCT CoreAlbums.AlbumID, CoreAlbums.Title, CoreArtists.Name, CoreTracks.Uri, CoreTracks.TrackID
                                    FROM CoreTracks, CoreArtists, CoreAlbums
                                WHERE
                                    CoreTracks.PrimarySourceID = ? AND
                                    CoreTracks.AlbumID = CoreAlbums.AlbumID AND
                                    CoreAlbums.ArtistID = CoreArtists.ArtistID AND
                                    CoreTracks.AlbumID NOT IN (
                                        SELECT AlbumID from AlbumArtWriter WHERE
                                            SavedOrTried > 0 AND LastUpdated >= ?)
                                GROUP BY CoreTracks.AlbumID ORDER BY CoreTracks.DateUpdatedStamp DESC LIMIT ?",
                                ServiceManager.SourceManager.MusicLibrary.DbId, TimeOffset, 1);
            SetResources (Resource.Database);
            PriorityHints = PriorityHints.LongRunning;

            IsBackground = true;
            CanCancel = true;
            DelayShow = true;
        }
开发者ID:nailyk,项目名称:banshee-community-extensions,代码行数:40,代码来源:AlbumArtWriterJob.cs


示例13: BpmDetectJob

        public BpmDetectJob () : base (Catalog.GetString ("Detecting BPM"))
        {
            IconNames = new string [] {"audio-x-generic"};
            IsBackground = true;
            SetResources (Resource.Cpu, Resource.Disk);
            PriorityHints = PriorityHints.LongRunning;

            music_library = ServiceManager.SourceManager.MusicLibrary;

            CountCommand = new HyenaSqliteCommand (String.Format (
                "SELECT COUNT(*) FROM CoreTracks WHERE PrimarySourceID = {0} AND (BPM = 0 OR BPM IS NULL)",
                music_library.DbId
            ));

            SelectCommand = new HyenaSqliteCommand (String.Format (@"
                SELECT DISTINCT {0}, TrackID
                FROM CoreTracks
                WHERE PrimarySourceID IN ({1}) AND (BPM IS NULL OR BPM = 0) LIMIT 1",
                Banshee.Query.BansheeQuery.UriField.Column, music_library.DbId
            ));

            Register ();
        }
开发者ID:gclark916,项目名称:banshee,代码行数:23,代码来源:BpmDetectJob.cs


示例14: AnalyzeLibraryJob

        public AnalyzeLibraryJob()
            : base(AddinManager.CurrentLocalizer.GetString ("Analyzing Song Similarity"))
        {
            IconNames = new string [] {"audio-x-generic"};
            IsBackground = true;
            SetResources (Resource.Cpu, Resource.Disk);
            PriorityHints = PriorityHints.LongRunning;

            var music_id = ServiceManager.SourceManager.MusicLibrary.DbId;

            CountCommand = new HyenaSqliteCommand (String.Format (
                @"SELECT COUNT(*)
                    FROM CoreTracks
                    WHERE PrimarySourceID IN ({0}) AND TrackID NOT IN
                        (SELECT TrackID FROM MirageTrackAnalysis)",
                music_id
            ));

            SelectCommand = new HyenaSqliteCommand (String.Format (@"
                SELECT TrackID
                    FROM CoreTracks
                    WHERE PrimarySourceID IN ({0}) AND TrackID NOT IN
                        (SELECT TrackID FROM MirageTrackAnalysis)
                    ORDER BY Rating DESC, PlayCount DESC LIMIT 1",
                music_id
            ));

            CancelMessage = AddinManager.CurrentLocalizer.GetString (
                "Are you sure you want to stop Mirage?\n" +
                "Shuffle by Similar will only work for the tracks which are already analyzed. " +
                "The operation can be resumed at any time from the <i>Tools</i> menu."
            );
            CanCancel = true;

            Register ();
        }
开发者ID:nailyk,项目名称:banshee-community-extensions,代码行数:36,代码来源:AnalyzeLibraryJob.cs


示例15: Run

        public void Run(object o, EventArgs e)
        {
            Photo[] photos = App.Instance.Organizer.SelectedPhotos ();

            if (photos.Length == 0) {
                Log.Debug ("no photos selected, returning");
                return;
            }

            DateTime import_time = photos[0].Time;
            foreach (Photo p in photos)
                if (p.Time > import_time)
                    import_time = p.Time;

            RollStore rolls = App.Instance.Database.Rolls;
            Roll roll = rolls.Create(import_time);
            foreach (Photo p in photos) {
                HyenaSqliteCommand cmd = new HyenaSqliteCommand ("UPDATE photos SET roll_id = ? " +
                                   "WHERE id = ? ", roll.Id, p.Id);
                App.Instance.Database.Database.Execute (cmd);
                p.RollId = roll.Id;
            }
            Log.Debug ("RetroactiveRoll done: " + photos.Length + " photos in roll " + roll.Id);
        }
开发者ID:Yetangitu,项目名称:f-spot,代码行数:24,代码来源:RetroactiveRoll.cs


示例16: IterateCore

        protected override void IterateCore (HyenaDataReader reader)
        {
            DatabaseTrackInfo track = DatabaseTrackInfo.Provider.Load (reader.Reader);

            var write_delay = track.DateUpdated.AddSeconds (2) - DateTime.Now;
            if (write_delay.TotalMilliseconds > 0) {
                System.Threading.Thread.Sleep (write_delay);
                return;
            }

            bool wrote = false;
            bool renamed = false;
            try {
                if (WriteMetadataEnabled || WriteRatingsAndPlayCountsEnabled) {
                    Hyena.Log.DebugFormat ("Saving metadata for {0}", track);
                    wrote = StreamTagger.SaveToFile (track, WriteMetadataEnabled, WriteRatingsAndPlayCountsEnabled);
                }

                // Rename tracks only from the Music Library
                if (RenameEnabled &&
                    track.PrimarySource.Equals (musicLibrarySource)) {
                    Hyena.Log.DebugFormat ("Updating file name for {0}", track);
                    renamed = RenameFile (track);
                    if (renamed && !wrote) {
                        track.LastSyncedStamp = DateTime.Now;
                    }
                }
            } catch (Exception) {
                Hyena.Log.ErrorFormat ("Error writing to or renaming {0}", track);
            } finally {
                if (wrote || renamed) {
                    // Save the resulting changes to FileSize, LastSyncedStamp, possibly to Uri, etc
                    // Clear track model caches if URI changed
                    track.Save (renamed);
                } else {
                    if (update_synced_at == null) {
                        update_synced_at = new HyenaSqliteCommand (
                            "UPDATE CoreTracks SET LastSyncedStamp = ? WHERE TrackID = ?");
                    }

                    ServiceManager.DbConnection.Execute (update_synced_at, DateTime.Now, track.TrackId);
                }
            }
        }
开发者ID:petejohanson,项目名称:banshee,代码行数:44,代码来源:SaveTrackMetadataJob.cs


示例17: ImportCore

        protected override void ImportCore ()
        {
            LibraryImportManager import_manager = ServiceManager.Get<LibraryImportManager> ();
            HyenaSqliteConnection conn;

            try {
                conn = new HyenaSqliteConnection (amarok_db_path);
            } catch (Exception e) {
                LogError (amarok_db_path, String.Format (
                    "Unable to open Amarok database: {0}", e.Message));
                return;
            }

            int count = 0;
            try {
                count = conn.Query<int> ("SELECT COUNT(*) FROM tags");
            } catch (Exception) {}

            try {
                HyenaSqliteCommand cmd = new HyenaSqliteCommand (@"
                    SELECT DISTINCT NULL,
                           tags.url,
                           tags.title,
                           artist.name,
                           genre.name,
                           album.name,
                           year.name,
                           tags.track,
                           tags.length
                     FROM  tags,
                           artist,
                           album,
                           genre,
                           year
                     WHERE tags.deviceid = -1
                       AND tags.artist = artist.id
                       AND tags.album = album.id
                       AND tags.genre = genre.id
                       AND tags.year = year.id"
                );

                HyenaSqliteCommand stats_cmd = new HyenaSqliteCommand (@"
                                                     SELECT DISTINCT (rating+rating%2)/2, playcounter, createdate, accessdate
                                                     FROM   statistics
                                                     WHERE  url = ? AND deviceid = -1");

                int processed = 0;

                IDataReader reader = conn.Query (cmd);
                while (reader.Read ()) {
                     if (CheckForCanceled ())
                         break;

                     processed++;

                     try {
                         string path = (string) reader[1];

                         SafeUri uri = null;
                         if (path.StartsWith ("./")) {
                             uri = new SafeUri (path.Substring (1));
                         } else if (path.StartsWith ("/")) {
                             uri = new SafeUri (path);
                         } else {
                             continue;
                         }

                         string title = (string) reader[2];
                         string artist = (string) reader[3];
                         //Console.WriteLine ("Amarok import has {0}/{1} - {2}", artist, title, uri);

                         // the following fields are not critical and can be skipped if something goes wrong
                         int rating = 0, playcount = 0;
                         long created = 0, accessed = 0;

                         // Try to read stats
                         try {
                             IDataReader stats_reader = conn.Query (stats_cmd, path);

                             while (stats_reader.Read ()) {
                                 rating = Convert.ToInt32 (stats_reader[0]);
                                 playcount = Convert.ToInt32 (stats_reader[1]);
                                 created = Convert.ToInt64 (stats_reader[2]);
                                 accessed = Convert.ToInt64 (stats_reader[3]);
                             }
                             stats_reader.Dispose ();
                         } catch (Exception) {}

                         UpdateUserJob (processed, count, artist, title);

                         try {
                             DatabaseTrackInfo track = import_manager.ImportTrack (uri);

                             if (track == null) {
                                 throw new Exception (String.Format (Catalog.GetString ("Unable to import track: {0}"), uri.AbsoluteUri));
                             }

                             if (rating > 0 || playcount > 0 || created > 0 || accessed > 0) {
                                 track.Rating = rating;
                                 track.PlayCount = playcount;
//.........这里部分代码省略.........
开发者ID:petejohanson,项目名称:banshee,代码行数:101,代码来源:AmarokPlayerImportSource.cs


示例18: MoodbarDetectJob

        public MoodbarDetectJob()
            : base(Catalog.GetString ("Detecting Mood"))
        {
            IconNames = new string[] { "audio-x-generic" };
            IsBackground = true;
            SetResources (Resource.Cpu, Resource.Disk);
            PriorityHints = PriorityHints.LongRunning;
            CanCancel = true;
            DelayShow = true;

            music_library = ServiceManager.SourceManager.MusicLibrary;

            CountCommand = new HyenaSqliteCommand (@"
                SELECT Uri
                    FROM CoreTracks
                    WHERE
                        PrimarySourceID = ? AND
                        TrackID NOT IN (
                            SELECT TrackID FROM MoodPaths
                            WHERE LastAttempt > ?
                        ) AND
                        TrackID NOT IN (
                            SELECT TrackID FROM MoodPaths
                            WHERE FileName IS NOT NULL
                        )
                        ",
                music_library.DbId, DateTime.Now - TimeSpan.FromDays (1));

            SelectCommand = new HyenaSqliteCommand (@"
                SELECT Uri
                    FROM CoreTracks
                    WHERE
                        PrimarySourceID = ? AND
                        TrackID NOT IN (
                            SELECT TrackID FROM MoodPaths
                            WHERE LastAttempt > ?
                        ) AND
                        TrackID NOT IN (
                            SELECT TrackID FROM MoodPaths
                            WHERE FileName IS NOT NULL
                        )
                    LIMIT 1",
                music_library.DbId, DateTime.Now - TimeSpan.FromDays (1));

            Register ();
        }
开发者ID:X4lldux,项目名称:banshee-moodbar-extension,代码行数:46,代码来源:MoodbarDetectJob.cs


示例19: Create

        private void Create()
        {
            HyenaSqliteCommand command = new HyenaSqliteCommand (
                @"INSERT INTO LastfmStations (Creator, Name, Type, Arg, PlayCount)
                    VALUES (?, ?, ?, ?, ?)",
                lastfm.Account.UserName, Name,
                Type.ToString (), Arg, PlayCount
            );

            dbid = ServiceManager.DbConnection.Execute (command);
            TypeUniqueId = dbid.ToString ();
        }
开发者ID:knocte,项目名称:banshee,代码行数:12,代码来源:StationSource.cs


示例20: Update

        private void Update()
        {
            HyenaSqliteCommand command = new HyenaSqliteCommand (
                @"UPDATE LastfmStations
                    SET Name = ?, Type = ?, Arg = ?, PlayCount = ?
                    WHERE StationID = ?",
                Name, Type.ToString (), Arg, PlayCount, dbid
            );
            ServiceManager.DbConnection.Execute (command);

            Station = Type.GetStationFor (Arg);
            OnUpdated ();
        }
开发者ID:knocte,项目名称:banshee,代码行数:13,代码来源:StationSource.cs



注:本文中的Hyena.Data.Sqlite.HyenaSqliteCommand类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Client.NetworkClient类代码示例发布时间:2022-05-26
下一篇:
C# Hyena.SafeUri类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap