Esempio n. 1
0
        public DetailsSource (Item item) : base (item.Title, item.Title, 195, "internet-archive-" + item.Id)
        {
            this.item = item;
            track_model = new MemoryTrackListModel ();
            track_model.Reloaded += delegate { OnUpdated (); };

            Properties.SetString ("ActiveSourceUIResource", "DetailsSourceActiveUI.xml");
            Properties.SetString ("GtkActionPath", "/IaDetailsSourcePopup");
            Properties.SetString ("UnmapSourceActionLabel", Catalog.GetString ("Close Item"));
            Properties.SetString ("UnmapSourceActionIconName", "gtk-close");

            SetIcon ();

            gui = new LazyLoadSourceContents<DetailsView> (this, item);
            Properties.Set<ISourceContents> ("Nereid.SourceContents", gui);
        }
Esempio n. 2
0
        public DetailsSource(Item item) : base(item.Title, item.Title, 195, "internet-archive-" + item.Id)
        {
            this.item             = item;
            track_model           = new MemoryTrackListModel();
            track_model.Reloaded += delegate { OnUpdated(); };

            Properties.SetString("ActiveSourceUIResource", "DetailsSourceActiveUI.xml");
            Properties.SetString("GtkActionPath", "/IaDetailsSourcePopup");
            Properties.SetString("UnmapSourceActionLabel", Catalog.GetString("Close Item"));
            Properties.SetString("UnmapSourceActionIconName", "gtk-close");

            SetIcon();

            gui = new LazyLoadSourceContents <DetailsView> (this, item);
            Properties.Set <ISourceContents> ("Nereid.SourceContents", gui);
        }
Esempio n. 3
0
        public AudiobookLibrarySource()
            : base(Catalog.GetString ("Audiobooks"), "AudiobookLibrary", 49)
        {
            MediaTypes = TrackMediaAttributes.AudioBook;
            NotMediaTypes = TrackMediaAttributes.Podcast | TrackMediaAttributes.VideoStream | TrackMediaAttributes.Music;
            SupportsPlaylists = false;

            Properties.SetStringList ("Icon.Name", "audiobook", "source-library");
            Properties.Set<string> ("SearchEntryDescription", Catalog.GetString ("Search your audiobooks"));
            Properties.SetString ("TrackView.ColumnControllerXml", String.Format (@"
                <column-controller>
                  <add-all-defaults />
                  <remove-default column=""DiscColumn"" />
                  <remove-default column=""AlbumColumn"" />
                  <remove-default column=""ComposerColumn"" />
                  <remove-default column=""AlbumArtistColumn"" />
                  <remove-default column=""ConductorColumn"" />
                  <remove-default column=""ComposerColumn"" />
                  <remove-default column=""BpmColumn"" />
                  <sort-column direction=""asc"">track_title</sort-column>
                  <column modify-default=""ArtistColumn"">
                    <title>{0}</title>
                    <long-title>{0}</long-title>
                  </column>
                </column-controller>
            ", Catalog.GetString ("Author")));

            var pattern = new AudiobookFileNamePattern ();
            pattern.FolderSchema = CreateSchema<string> ("folder_pattern", pattern.DefaultFolder, "", "");
            pattern.FileSchema   = CreateSchema<string> ("file_pattern",   pattern.DefaultFile, "", "");
            SetFileNamePattern (pattern);

            Actions = new Actions (this);

            grid_view = new LazyLoadSourceContents<AudiobookContent> ();
            book_view = new LazyLoadSourceContents<BookView> ();
            Properties.Set<ISourceContents> ("Nereid.SourceContents", grid_view);

            Properties.Set<System.Reflection.Assembly> ("ActiveSourceUIResource.Assembly", System.Reflection.Assembly.GetExecutingAssembly ());
            Properties.SetString ("ActiveSourceUIResource", "ActiveSourceUI.xml");
            Properties.Set<bool> ("ActiveSourceUIResourcePropagate", true);
            Properties.Set<System.Action> ("ActivationAction", delegate { SwitchToGridView (); });

            TracksAdded += (o, a) => {
                if (!IsAdding) {
                    MergeBooksAddedSince (DateTime.Now - TimeSpan.FromHours (2));

                    ServiceManager.DbConnection.Execute (
                        "UPDATE CoreTracks SET Attributes = Attributes | ? WHERE PrimarySourceID = ?",
                        (int)TrackMediaAttributes.AudioBook, this.DbId);
                }
            };

            TrackIsPlayingHandler = ServiceManager.PlayerEngine.IsPlaying;

            PlaybackSource = new BookPlaylist ("audiobook-playback-source", this);
            PlaybackSource.DatabaseTrackModel.ForcedSortQuery = BansheeQuery.GetSort (BansheeQuery.TrackNumberField, true);

            ServiceManager.PlaybackController.SourceChanged += OnPlaybackSourceChanged;

            // Listen for playback changes and auto-set the last-played bookmark
            ServiceManager.PlayerEngine.ConnectEvent (OnPlayerEvent,
                PlayerEvent.StartOfStream | PlayerEvent.EndOfStream | PlayerEvent.Seek,
                true);
        }
        public AudiobookLibrarySource() : base(Catalog.GetString("Audiobooks"), "AudiobookLibrary", 49)
        {
            MediaTypes        = TrackMediaAttributes.AudioBook;
            NotMediaTypes     = TrackMediaAttributes.Podcast | TrackMediaAttributes.VideoStream | TrackMediaAttributes.Music;
            SupportsPlaylists = false;

            Properties.SetStringList("Icon.Name", "audiobook", "source-library");
            Properties.Set <string> ("SearchEntryDescription", Catalog.GetString("Search your audiobooks"));
            Properties.SetString("TrackView.ColumnControllerXml", String.Format(@"
                <column-controller>
                  <add-all-defaults />
                  <remove-default column=""DiscColumn"" />
                  <remove-default column=""AlbumColumn"" />
                  <remove-default column=""ComposerColumn"" />
                  <remove-default column=""AlbumArtistColumn"" />
                  <remove-default column=""ConductorColumn"" />
                  <remove-default column=""ComposerColumn"" />
                  <remove-default column=""BpmColumn"" />
                  <sort-column direction=""asc"">track_title</sort-column>
                  <column modify-default=""ArtistColumn"">
                    <title>{0}</title>
                    <long-title>{0}</long-title>
                  </column>
                </column-controller>
            ", Catalog.GetString("Author")));

            var pattern = new AudiobookFileNamePattern();

            pattern.FolderSchema = CreateSchema <string> ("folder_pattern", pattern.DefaultFolder, "", "");
            pattern.FileSchema   = CreateSchema <string> ("file_pattern", pattern.DefaultFile, "", "");
            SetFileNamePattern(pattern);

            Actions = new Actions(this);

            grid_view = new LazyLoadSourceContents <AudiobookContent> ();
            book_view = new LazyLoadSourceContents <BookView> ();
            Properties.Set <ISourceContents> ("Nereid.SourceContents", grid_view);

            Properties.Set <System.Reflection.Assembly> ("ActiveSourceUIResource.Assembly", System.Reflection.Assembly.GetExecutingAssembly());
            Properties.SetString("ActiveSourceUIResource", "ActiveSourceUI.xml");
            Properties.Set <bool> ("ActiveSourceUIResourcePropagate", true);
            Properties.Set <System.Action> ("ActivationAction", delegate { SwitchToGridView(); });

            TracksAdded += (o, a) => {
                if (!IsAdding)
                {
                    MergeBooksAddedSince(DateTime.Now - TimeSpan.FromHours(2));

                    ServiceManager.DbConnection.Execute(
                        "UPDATE CoreTracks SET Attributes = Attributes | ? WHERE PrimarySourceID = ?",
                        (int)TrackMediaAttributes.AudioBook, this.DbId);
                }
            };

            TrackIsPlayingHandler = ServiceManager.PlayerEngine.IsPlaying;

            PlaybackSource = new BookPlaylist("audiobook-playback-source", this);
            PlaybackSource.DatabaseTrackModel.ForcedSortQuery = BansheeQuery.GetSort(BansheeQuery.TrackNumberField, true);

            ServiceManager.PlaybackController.SourceChanged += OnPlaybackSourceChanged;

            // Listen for playback changes and auto-set the last-played bookmark
            ServiceManager.PlayerEngine.ConnectEvent(OnPlayerEvent,
                                                     PlayerEvent.StartOfStream | PlayerEvent.EndOfStream | PlayerEvent.Seek,
                                                     true);
        }