From f9068bc2810eccf794e7468ffb72de21e2d58916 Mon Sep 17 00:00:00 2001 From: Bernhard Gebetsberger Date: Thu, 5 Mar 2020 00:15:01 +0100 Subject: [PATCH 01/39] Strip out weekday from Episode pubDate --- src/Objects/Episode.vala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Objects/Episode.vala b/src/Objects/Episode.vala index dfffaab..64d1421 100644 --- a/src/Objects/Episode.vala +++ b/src/Objects/Episode.vala @@ -116,7 +116,8 @@ namespace Vocal { if (date_released != null) { GLib.Time tm = GLib.Time (); - tm.strptime (date_released, "%a, %d %b %Y %H:%M:%S %Z"); + date_released = date_released[5:date_released.length]; + tm.strptime (date_released, "%d %b %Y %H:%M:%S %Z"); datetime_released = new DateTime.local ( 1900 + tm.year, 1 + tm.month, From 5ea1f4374d5af04dce188c1f143a9a2df891053f Mon Sep 17 00:00:00 2001 From: sridhars Date: Fri, 27 Mar 2020 07:20:15 -0400 Subject: [PATCH 02/39] Fix Regex to properly ignore (.*?)<[\\s\\/]*?a[\\s>]*", + Regex simpleLinks = new Regex ("(.*?)<[\\s\\/]*?a[\\s>]*", RegexCompileFlags.CASELESS | RegexCompileFlags.DOTALL); markup = simpleLinks.replace (markup, -1, 0, "?a? \\2?a-end?\\3 ?/a?"); From e475f9eaa534b2e0ab62ef474dc411fe43ea09b2 Mon Sep 17 00:00:00 2001 From: Brn9hrd7 <46742447+Brn9hrd7@users.noreply.github.com> Date: Fri, 27 Mar 2020 12:24:48 +0100 Subject: [PATCH 03/39] Add gvfs to dependency list (#441) --- INSTALL | 1 + 1 file changed, 1 insertion(+) diff --git a/INSTALL b/INSTALL index 9a99afb..127ad4c 100644 --- a/INSTALL +++ b/INSTALL @@ -7,6 +7,7 @@ libxml-2.0 granite gtk+-3.0 gstreamer-1.0 +gvfs sqlite3 From 1219e0c350a6b3c423a00a3a39297561e11ac7e7 Mon Sep 17 00:00:00 2001 From: Brn9hrd7 <46742447+Brn9hrd7@users.noreply.github.com> Date: Sat, 28 Mar 2020 17:27:42 +0100 Subject: [PATCH 04/39] Infobar improvements when adding a podcast (#438) * Use markup in infobar * Hide infobar automatically after adding podcast --- src/Controller.vala | 1 + src/MainWindow.vala | 1 + 2 files changed, 2 insertions(+) diff --git a/src/Controller.vala b/src/Controller.vala index 9d2b4bd..eea1230 100644 --- a/src/Controller.vala +++ b/src/Controller.vala @@ -571,6 +571,7 @@ namespace Vocal { if (success) { + window.hide_infobar (); window.toolbar.playback_box.show_artwork_image (); window.toolbar.playback_box.show_volume_button (); diff --git a/src/MainWindow.vala b/src/MainWindow.vala index 920092d..de4609d 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -1867,6 +1867,7 @@ namespace Vocal { } var message_label = new Gtk.Label (message); message_label.margin_left = 12; + message_label.use_markup = true; content_area.add (message_label); infobar.revealed = true; From 491d7208169ad51a019583180d93b2d3b460c340 Mon Sep 17 00:00:00 2001 From: Bernhard Gebetsberger Date: Tue, 10 Mar 2020 23:09:25 +0100 Subject: [PATCH 05/39] Fix GLib Errors TRACK_ID may not be a negative number --- src/Utils/MPRIS.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Utils/MPRIS.vala b/src/Utils/MPRIS.vala index 8978433..c0ef071 100644 --- a/src/Utils/MPRIS.vala +++ b/src/Utils/MPRIS.vala @@ -146,7 +146,7 @@ namespace Vocal { private const string INTERFACE_NAME = "org.mpris.MediaPlayer2.Player"; - const string TRACK_ID = "/com/github/needleandthread/vocal/Track/%d"; + const string TRACK_ID = "/com/github/needleandthread/vocal/Track/%u"; public MprisPlayer (DBusConnection conn) { this.conn = conn; From defb81252f3846b0223ef8611729a87c26188236 Mon Sep 17 00:00:00 2001 From: Bernhard Gebetsberger Date: Wed, 11 Mar 2020 13:14:17 +0100 Subject: [PATCH 06/39] Add Feeds/Episodes only if they contain an Audio/Video file --- src/Utils/FeedParser.vala | 60 +++++++++++++++++++++++++-------------- 1 file changed, 39 insertions(+), 21 deletions(-) diff --git a/src/Utils/FeedParser.vala b/src/Utils/FeedParser.vala index 46f09c1..884cccc 100644 --- a/src/Utils/FeedParser.vala +++ b/src/Utils/FeedParser.vala @@ -132,6 +132,7 @@ namespace Vocal { Episode episode = new Episode (); string next_item_in_queue = null; bool found_summary = false; + bool found_media = false; while (next_item_in_queue != "item" && i < queue.size - 1) { i++; @@ -162,6 +163,11 @@ namespace Vocal { i++; string typestring = queue[i].slice (0, 5); + + if (typestring == "audio" || typestring == "video") { + found_media = true; + } + if (podcast.content_type == MediaType.UNKNOWN) { if (typestring == "audio") { podcast.content_type = MediaType.AUDIO; @@ -169,10 +175,6 @@ namespace Vocal { else if (typestring == "video") { podcast.content_type = MediaType.VIDEO; } - else { - podcast.content_type = MediaType.UNKNOWN; - } - } type_found = true; @@ -209,7 +211,9 @@ namespace Vocal { // Add the new episode to the podcast - podcast.add_episode (episode); + if (found_media) { + podcast.add_episode (episode); + } } @@ -339,6 +343,11 @@ namespace Vocal { podcast = create_podcast_from_queue (); } + if (podcast.content_type == MediaType.UNKNOWN) { + warning ("Feed doesn't contain any media files. Abort."); + return null; + } + if (podcast.name.length < 1) { warning ("Something went wrong during podcast parsing. Abort."); return null; @@ -542,6 +551,7 @@ namespace Vocal { Episode episode = new Episode (); string next_item_in_queue = null; bool found_summary = false; + bool found_media = false; while (next_item_in_queue != "item" && i < queue.size - 1) { @@ -572,6 +582,11 @@ namespace Vocal { i++; string typestring = queue[i].slice (0, 5); + + if (typestring == "audio" || typestring == "video") { + found_media = true; + } + if (podcast.content_type == MediaType.UNKNOWN) { if (typestring == "audio") { podcast.content_type = MediaType.AUDIO; @@ -579,10 +594,6 @@ namespace Vocal { else if (typestring == "video") { podcast.content_type = MediaType.VIDEO; } - else { - podcast.content_type = MediaType.UNKNOWN; - } - } type_found = true; @@ -618,17 +629,19 @@ namespace Vocal { } - episode.parent = podcast; - episode.podcast_uri = podcast.feed_uri; + if (found_media) { + episode.parent = podcast; + episode.podcast_uri = podcast.feed_uri; - if (previous_newest_episode != null) { - if (episode.title == previous_newest_episode.title.replace ("%27", "'")) { - previous_found = true; + if (previous_newest_episode != null) { + if (episode.title == previous_newest_episode.title.replace ("%27", "'")) { + previous_found = true; + } else { + new_episodes.add (episode); + } } else { new_episodes.add (episode); } - } else { - new_episodes.add (episode); } } @@ -677,6 +690,7 @@ namespace Vocal { /* Creating a Episode with values from tag. */ Episode entry = new Episode (); + bool found_media = false; for (Xml.Node* iterEntry = iter->children; iterEntry != null; iterEntry = iterEntry->next) { switch (iterEntry->name) { @@ -699,12 +713,14 @@ namespace Vocal { entry.uri=propEntry->children->content; entry.link = entry.uri; } else if (attr_name == "type" && podcast != null) { - podcast.content_type = MediaType.UNKNOWN; - if (propEntry->children->content.contains ("audio/")) { podcast.content_type = MediaType.AUDIO; + found_media = true; } else if (propEntry->children->content.contains ("video/")) { podcast.content_type = MediaType.VIDEO; + found_media = true; + } else { + podcast.content_type = MediaType.UNKNOWN; } } } @@ -717,10 +733,12 @@ namespace Vocal { } } - entry.parent=podcast; - entry.podcast_uri = podcast.feed_uri; + if (found_media) { + entry.parent=podcast; + entry.podcast_uri = podcast.feed_uri; - episodes.add (entry); + episodes.add (entry); + } } for (int i=episodes.size; i > 0 && !previous_found; i--) { From e8a346a9d078a778a142936a2e5c9ad56ed6fc9e Mon Sep 17 00:00:00 2001 From: Bernhard Gebetsberger Date: Fri, 13 Mar 2020 00:56:25 +0100 Subject: [PATCH 07/39] Restore position of last played episode --- src/MainWindow.vala | 2 +- src/Utils/Player.vala | 21 +++++++++++---------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/MainWindow.vala b/src/MainWindow.vala index de4609d..d1ecd2d 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -649,7 +649,7 @@ namespace Vocal { try { controller.player.set_episode (controller.current_episode); - controller.player.set_position (controller.current_episode.last_played_position); + controller.player.restore_position_episode = controller.current_episode; artwork_popover.set_notes_text (episode.description); } catch (Error e) { diff --git a/src/Utils/Player.vala b/src/Utils/Player.vala index 9bf9659..c40292a 100644 --- a/src/Utils/Player.vala +++ b/src/Utils/Player.vala @@ -40,22 +40,21 @@ namespace Vocal { private string tag_string; public Episode current_episode; + public Episode? restore_position_episode = null; private Player (string[]? args) { - bool new_launch = true; - current_episode = null; // Check every half-second if the current media is playing, and if it is // send a signal that there is a new position available GLib.Timeout.add (500, () => { - - if (playing) + if (playing && duration > 0.0) { + if (restore_position_episode == current_episode) { + set_position (current_episode.last_played_position); + restore_position_episode = null; + } new_position_available (); - if (new_launch && duration > 0.0) { - new_position_available (); - new_launch = false; } return true; }); @@ -146,9 +145,11 @@ namespace Vocal { * Sets the currently playing media position, in seconds */ public void set_position (int seconds) { - double calculated_progress = (double)seconds / get_duration (); - set_progress (calculated_progress); - new_position_available (); + if (duration > 0.0) { + double calculated_progress = (double)seconds / duration; + set_progress (calculated_progress); + new_position_available (); + } } From 13446f9a5c7f76cfb22eff212b6c0945ef2e2c4b Mon Sep 17 00:00:00 2001 From: Bernhard Gebetsberger Date: Fri, 13 Mar 2020 00:59:29 +0100 Subject: [PATCH 08/39] Unset last_played_media when last Episode finished --- src/MainWindow.vala | 1 + 1 file changed, 1 insertion(+) diff --git a/src/MainWindow.vala b/src/MainWindow.vala index d1ecd2d..9db620c 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -1659,6 +1659,7 @@ namespace Vocal { controller.settings.last_played_media = "%s,%s".printf (controller.current_episode.title, controller.current_episode.parent.name); } else { controller.player.playing = false; + controller.settings.last_played_media = ""; } // Regenerate the new episode list in case the ended episode was one of the new episodes From 5fe4381f9e3b31694d13bcd8a75e6efd51b20ad0 Mon Sep 17 00:00:00 2001 From: Bernhard Gebetsberger Date: Fri, 13 Mar 2020 01:08:29 +0100 Subject: [PATCH 09/39] Fix formatting --- src/Utils/Player.vala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Utils/Player.vala b/src/Utils/Player.vala index c40292a..70983fb 100644 --- a/src/Utils/Player.vala +++ b/src/Utils/Player.vala @@ -146,9 +146,9 @@ namespace Vocal { */ public void set_position (int seconds) { if (duration > 0.0) { - double calculated_progress = (double)seconds / duration; - set_progress (calculated_progress); - new_position_available (); + double calculated_progress = (double)seconds / duration; + set_progress (calculated_progress); + new_position_available (); } } From 76fd1bb9d76c7fa321fb22138c15a6434912b71c Mon Sep 17 00:00:00 2001 From: Bernhard Gebetsberger Date: Fri, 13 Mar 2020 01:13:50 +0100 Subject: [PATCH 10/39] I don't like tabs anymore --- src/Utils/Player.vala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Utils/Player.vala b/src/Utils/Player.vala index 70983fb..c550331 100644 --- a/src/Utils/Player.vala +++ b/src/Utils/Player.vala @@ -144,13 +144,13 @@ namespace Vocal { /* * Sets the currently playing media position, in seconds */ - public void set_position (int seconds) { + public void set_position (int seconds) { if (duration > 0.0) { double calculated_progress = (double)seconds / duration; set_progress (calculated_progress); new_position_available (); } - } + } /* From dd02464710b8790aaf85a44540ffc8f719904e94 Mon Sep 17 00:00:00 2001 From: Bernhard Gebetsberger Date: Fri, 13 Mar 2020 21:02:12 +0100 Subject: [PATCH 11/39] Export: Use CDATA instead of replacing characters --- src/Library.vala | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Library.vala b/src/Library.vala index 848d24e..cccb08e 100644 --- a/src/Library.vala +++ b/src/Library.vala @@ -717,8 +717,12 @@ namespace Vocal { foreach (Podcast p in podcasts) { output_line = - """ - """.printf (p.name.replace ("\"", "'").replace ("&", "and"), p.feed_uri); +""" + + rss + + +""".printf (p.name, p.feed_uri); stream.output_stream.write (output_line.data); } From 4acbf42f832dfbc92b7d4c16b7ce1507969d41d5 Mon Sep 17 00:00:00 2001 From: Bernhard Gebetsberger Date: Sat, 14 Mar 2020 01:13:34 +0100 Subject: [PATCH 12/39] Don't toggle elements of Toolbar when adding feeds I don't see any reason why this should be done here. --- src/Controller.vala | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/Controller.vala b/src/Controller.vala index eea1230..e5e953b 100644 --- a/src/Controller.vala +++ b/src/Controller.vala @@ -546,13 +546,7 @@ namespace Vocal { } } - // Hide the shownotes button - window.toolbar.playback_box.hide_artwork_image (); - window.toolbar.playback_box.hide_volume_button (); - window.toolbar.hide_playlist_button (); - window.show_infobar (_ ("Adding new podcast: " + feed + ""), MessageType.INFO); - window.toolbar.show_playback_box (); var loop = new MainLoop (); bool success = false; From 429974d598e1cd92d14db2a46359fa3ed748ec1c Mon Sep 17 00:00:00 2001 From: Bernhard Gebetsberger Date: Sat, 14 Mar 2020 01:37:12 +0100 Subject: [PATCH 13/39] Don't try to update gpodder when not logged in --- src/Utils/gpodderClient.vala | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Utils/gpodderClient.vala b/src/Utils/gpodderClient.vala index 56cccf4..a6e7962 100644 --- a/src/Utils/gpodderClient.vala +++ b/src/Utils/gpodderClient.vala @@ -483,6 +483,10 @@ namespace Vocal { } public bool update_episode (Episode episode, EpisodeAction action) { + + if (controller.settings.gpodder_username == "") { + return false; + } var session = new Soup.Session (); session.user_agent = "vocal"; From 9f12eeca76573408737b95bdb7883866244b9997 Mon Sep 17 00:00:00 2001 From: Bernhard Gebetsberger Date: Sat, 14 Mar 2020 12:01:33 +0100 Subject: [PATCH 14/39] Fix crash when trying to play an Episode Use controller.current_episode because episode can be null here --- src/MainWindow.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MainWindow.vala b/src/MainWindow.vala index 9db620c..361f2fd 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -801,7 +801,7 @@ namespace Vocal { // Set the shownotes, the media information, and update the last played media in the settings controller.track_changed (controller.current_episode.title, controller.current_episode.parent.name, controller.current_episode.parent.coverart_uri, (uint64) controller.player.duration); - toolbar.playback_box.set_artwork_image_image (episode.parent.coverart_uri); + toolbar.playback_box.set_artwork_image_image (controller.current_episode.parent.coverart_uri); artwork_popover.set_notes_text (controller.current_episode.description); controller.settings.last_played_media = "%s,%s".printf (controller.current_episode.title, controller.current_episode.parent.name); } From 26d8b4194217c7a7235d390c3608bb74ec3e990f Mon Sep 17 00:00:00 2001 From: Bernhard Gebetsberger Date: Mon, 16 Mar 2020 15:00:28 +0100 Subject: [PATCH 15/39] Fix to correctly restore episode position This isn't needed anymore, because the Position gets restored in Player.vala now. --- src/Controller.vala | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/src/Controller.vala b/src/Controller.vala index e5e953b..80b0d5f 100644 --- a/src/Controller.vala +++ b/src/Controller.vala @@ -432,25 +432,6 @@ namespace Vocal { player.play (); playback_status_changed ("Playing"); - // Seek if necessary - if (current_episode.last_played_position > 0 && current_episode.last_played_position > player.get_position ()) { - - // If it's a streaming episode, seeking takes longer - // Temporarily pause the track and give it some time to seek - if (current_episode.current_download_status == DownloadStatus.NOT_DOWNLOADED) { - player.pause (); - } - - player.set_position (current_episode.last_played_position); - - // Pause for about a second to give time to catch up - if (current_episode.current_download_status == DownloadStatus.NOT_DOWNLOADED) { - player.pause (); - Thread.usleep (700000); - player.play (); - } - } - var playpause_image = new Gtk.Image.from_icon_name ("media-playback-pause-symbolic", Gtk.IconSize.LARGE_TOOLBAR); window.toolbar.set_play_pause_image (playpause_image); window.toolbar.set_play_pause_text (_ ("Pause")); From 82d67e4aefa88e0dde5c51b0417624da9b892029 Mon Sep 17 00:00:00 2001 From: Bernhard Gebetsberger Date: Mon, 16 Mar 2020 15:42:31 +0100 Subject: [PATCH 16/39] Use array instead of string to save last played media This prevents issues when the Podcast/Episode title contains a comma --- com.github.needleandthread.vocal.gschema.xml | 6 +++--- src/MainWindow.vala | 10 +++++----- src/VocalSettings.vala | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/com.github.needleandthread.vocal.gschema.xml b/com.github.needleandthread.vocal.gschema.xml index 69f28b3..6d057fc 100644 --- a/com.github.needleandthread.vocal.gschema.xml +++ b/com.github.needleandthread.vocal.gschema.xml @@ -74,11 +74,11 @@ - - "" + + [] The podcast and episode that was last playing - The podcast and episode that was last played, in podcast_name,episode_title format + The podcast and episode that was last played. diff --git a/src/MainWindow.vala b/src/MainWindow.vala index 361f2fd..fd58066 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -630,7 +630,7 @@ namespace Vocal { if (controller.settings.last_played_media != null && controller.settings.last_played_media.length > 1) { // Split the media into two different strings - string[] fields = controller.settings.last_played_media.split (","); + string[] fields = controller.settings.last_played_media; bool found = false; foreach (Podcast podcast in controller.library.podcasts) { @@ -781,7 +781,7 @@ namespace Vocal { // Set the shownotes, the media information, and update the last played media in the settings controller.track_changed (controller.current_episode.title, controller.current_episode.parent.name, controller.current_episode.parent.coverart_uri, (uint64)controller.player.duration); artwork_popover.set_notes_text (controller.current_episode.description); - controller.settings.last_played_media = "%s,%s".printf (controller.current_episode.title, controller.current_episode.parent.name); + controller.settings.last_played_media = {controller.current_episode.title, controller.current_episode.parent.name}; } /* @@ -803,7 +803,7 @@ namespace Vocal { controller.track_changed (controller.current_episode.title, controller.current_episode.parent.name, controller.current_episode.parent.coverart_uri, (uint64) controller.player.duration); toolbar.playback_box.set_artwork_image_image (controller.current_episode.parent.coverart_uri); artwork_popover.set_notes_text (controller.current_episode.description); - controller.settings.last_played_media = "%s,%s".printf (controller.current_episode.title, controller.current_episode.parent.name); + controller.settings.last_played_media = {controller.current_episode.title, controller.current_episode.parent.name}; } /* @@ -1656,10 +1656,10 @@ namespace Vocal { // Set the shownotes, the media information, and update the last played media in the settings controller.track_changed (controller.current_episode.title, controller.current_episode.parent.name, controller.current_episode.parent.coverart_uri, (uint64) controller.player.duration); artwork_popover.set_notes_text (controller.current_episode.description); - controller.settings.last_played_media = "%s,%s".printf (controller.current_episode.title, controller.current_episode.parent.name); + controller.settings.last_played_media = {controller.current_episode.title, controller.current_episode.parent.name}; } else { controller.player.playing = false; - controller.settings.last_played_media = ""; + controller.settings.last_played_media = null; } // Regenerate the new episode list in case the ended episode was one of the new episodes diff --git a/src/VocalSettings.vala b/src/VocalSettings.vala index 5578102..bfc9d6b 100644 --- a/src/VocalSettings.vala +++ b/src/VocalSettings.vala @@ -39,7 +39,7 @@ public class VocalSettings : Granite.Services.Settings { public int rewind_seconds { get; set;} public string library_location { get; set; } - public string last_played_media { get; set; } + public string[] last_played_media { get; set; } public string itunes_store_country { get; set; } public string archive_access_key { get; set; } public string archive_secret_key { get; set; } From 430310b98a471fddcf5a7927bebf47bfe59eff54 Mon Sep 17 00:00:00 2001 From: Bernhard Gebetsberger Date: Tue, 31 Mar 2020 02:46:11 +0200 Subject: [PATCH 17/39] Fix height of iTunes search results --- src/Widgets/SearchResultsView.vala | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Widgets/SearchResultsView.vala b/src/Widgets/SearchResultsView.vala index c08650a..e788fec 100644 --- a/src/Widgets/SearchResultsView.vala +++ b/src/Widgets/SearchResultsView.vala @@ -143,9 +143,7 @@ namespace Vocal { local_episodes_listbox.button_press_event.connect (on_episode_activated); local_podcasts_listbox.button_press_event.connect (on_podcast_activated); - local_episodes_listbox.expand = true; - local_podcasts_listbox.expand = true; - cloud_results_flowbox.expand = true; + content_box.expand = true; local_episodes_widgets = new Gee.ArrayList (); local_podcasts_widgets = new Gee.ArrayList (); From b6ccc674dc5df50d39e66778c3df72f4133b648d Mon Sep 17 00:00:00 2001 From: Bernhard Gebetsberger Date: Tue, 31 Mar 2020 02:53:14 +0200 Subject: [PATCH 18/39] Increase max number of items per line to scale better on high resolution or ultrawide monitors --- src/MainWindow.vala | 1 + 1 file changed, 1 insertion(+) diff --git a/src/MainWindow.vala b/src/MainWindow.vala index fd58066..b70d1d9 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -347,6 +347,7 @@ namespace Vocal { all_flowbox = new Gtk.FlowBox (); all_art = new Gee.ArrayList (); all_flowbox.get_style_context ().add_class ("notebook-art"); + all_flowbox.max_children_per_line = 20; all_flowbox.selection_mode = Gtk.SelectionMode.SINGLE; all_flowbox.activate_on_single_click = true; all_flowbox.child_activated.connect (on_child_activated); From 598be9000af85e14a0d4bd40a7534fb2f9c420b1 Mon Sep 17 00:00:00 2001 From: Bernhard Gebetsberger Date: Tue, 31 Mar 2020 02:55:43 +0200 Subject: [PATCH 19/39] Increase spacing in Headerbar spacing = 0 causes issues with some themes (partly overlapping buttons) --- src/Widgets/Toolbar.vala | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Widgets/Toolbar.vala b/src/Widgets/Toolbar.vala index 59bc671..d554fd3 100644 --- a/src/Widgets/Toolbar.vala +++ b/src/Widgets/Toolbar.vala @@ -375,8 +375,6 @@ namespace Vocal { right_button_box.pack_end (new_episodes_button); right_button_box.halign = Gtk.Align.END; - this.spacing = 0; - this.pack_start (left_button_box); this.set_custom_title (playback_box); this.pack_end (right_button_box); From 962eda6bc9f01953fa1e8845ff148200149bdcb5 Mon Sep 17 00:00:00 2001 From: Bernhard Gebetsberger Date: Fri, 3 Apr 2020 00:27:12 +0200 Subject: [PATCH 20/39] Fix two crashes after selecting multiple episodes --- src/Widgets/PodcastView.vala | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Widgets/PodcastView.vala b/src/Widgets/PodcastView.vala index cc90ae9..6158f1d 100644 --- a/src/Widgets/PodcastView.vala +++ b/src/Widgets/PodcastView.vala @@ -663,7 +663,7 @@ namespace Vocal { private void on_row_selected () { GLib.List rows = listbox.get_selected_rows (); - if (rows.length () < 1) { + if (rows.length () != 1) { return; } @@ -721,7 +721,9 @@ namespace Vocal { private void reset_episode_list () { foreach (var item in listbox.get_children ()) { - listbox.remove (item); + ListBoxRow row = (ListBoxRow) item; + row.selectable = false; + listbox.remove (row); } boxes.clear (); From 8f2bfa46a0fd73b929a00cccf8ad857620b4d2e9 Mon Sep 17 00:00:00 2001 From: Bernhard Gebetsberger Date: Sat, 4 Apr 2020 15:23:33 +0200 Subject: [PATCH 21/39] Change libunity desktop id --- src/Library.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Library.vala b/src/Library.vala index cccb08e..393372b 100644 --- a/src/Library.vala +++ b/src/Library.vala @@ -100,7 +100,7 @@ namespace Vocal { local_library_path = settings.library_location.replace ("~", GLib.Environment.get_home_dir ()); #if HAVE_LIBUNITY - launcher = Unity.LauncherEntry.get_for_desktop_id ("vocal.desktop"); + launcher = Unity.LauncherEntry.get_for_desktop_id ("com.github.needleandthread.vocal.desktop"); launcher.count = new_episode_count; #endif From 94fa3b0f2294fc539b6f361ee7023784ab5efcde Mon Sep 17 00:00:00 2001 From: Bernhard Gebetsberger Date: Sat, 4 Apr 2020 16:00:53 +0200 Subject: [PATCH 22/39] Sort episodes by release date in SQL query This avoids an issue where Episodes are getting marked as new after interacting with an older episode(Playing, marking as new/played). --- src/Library.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Library.vala b/src/Library.vala index 393372b..8f5e015 100644 --- a/src/Library.vala +++ b/src/Library.vala @@ -909,7 +909,7 @@ namespace Vocal { FROM Episode e LEFT JOIN Podcast p on p.feed_uri = e.podcast_uri WHERE podcast_uri = '%s' - ORDER BY e.rowid ASC".printf (podcast.feed_uri); + ORDER BY e.released ASC".printf (podcast.feed_uri); ec = db.prepare_v2 (prepared_query_str, prepared_query_str.length, out stmt); if (ec != Sqlite.OK) { warning ("Error: %d: %s\n", db.errcode (), db.errmsg ()); From c9145e72167652db780a72870560c13d550bab5b Mon Sep 17 00:00:00 2001 From: Bernhard Gebetsberger Date: Sat, 4 Apr 2020 17:46:33 +0200 Subject: [PATCH 23/39] Show status when loading iTunes Top 100 --- src/Widgets/DirectoryView.vala | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Widgets/DirectoryView.vala b/src/Widgets/DirectoryView.vala index 9f93ea3..8ebcd86 100644 --- a/src/Widgets/DirectoryView.vala +++ b/src/Widgets/DirectoryView.vala @@ -33,6 +33,8 @@ namespace Vocal { private Gtk.Button first_run_continue_button; private Gtk.Box loading_box; + private Gtk.Label itunes_title; + private Gtk.Label loading_label; private Gtk.ScrolledWindow scrolled_window; @@ -48,7 +50,7 @@ namespace Vocal { banner_box.get_style_context ().add_class ("toolbar"); banner_box.get_style_context ().add_class ("library-toolbar"); - var itunes_title = new Gtk.Label (_ ("iTunes Top 100 Podcasts")); + itunes_title = new Gtk.Label (_ ("iTunes Top 100 Podcasts")); itunes_title.margin_top = 15; itunes_title.margin_bottom = 5; itunes_title.justify = Gtk.Justification.CENTER; @@ -101,7 +103,7 @@ namespace Vocal { loading_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 5); var spinner = new Gtk.Spinner (); spinner.active = true; - var loading_label = new Gtk.Label (_ ("Loading iTunes Store")); + loading_label = new Gtk.Label (_ ("Loading iTunes Store (0 / 100)")); loading_label.get_style_context ().add_class ("h2"); loading_box.add (loading_label); loading_box.add (spinner); @@ -131,6 +133,8 @@ namespace Vocal { int i = 1; if (entries == null) { info ("iterating over entries"); + itunes_title.set_text ("Error when loading iTunes Top 100 Podcasts"); + loading_box.set_no_show_all (true); return null; } @@ -148,6 +152,7 @@ namespace Vocal { on_new_subscription (url); }); flowbox.add (directory_art); + loading_label.set_text ("Loading iTunes Store (%d / 100)".printf (i)); i++; } From 2956e800e461fe9f1839ce8ae04bef2e7251ea44 Mon Sep 17 00:00:00 2001 From: Bernhard Gebetsberger Date: Sun, 5 Apr 2020 02:17:59 +0200 Subject: [PATCH 24/39] Code deduplication --- src/Controller.vala | 26 +++++++++++++++++- src/MainWindow.vala | 66 +++++++++++---------------------------------- 2 files changed, 40 insertions(+), 52 deletions(-) diff --git a/src/Controller.vala b/src/Controller.vala index 80b0d5f..4eacb7b 100644 --- a/src/Controller.vala +++ b/src/Controller.vala @@ -63,7 +63,7 @@ namespace Vocal { /* References, pointers, and containers */ - public Episode current_episode; + private Episode current_episode; public Podcast highlighted_podcast; /* Miscellaneous global variables */ @@ -363,6 +363,30 @@ namespace Vocal { } } + public void set_episode (Episode? e) { + current_episode = e; + if (current_episode != null) { + try { + player.set_episode (current_episode); + window.toolbar.playback_box.set_info_title (current_episode.title.replace ("%27", "'"), current_episode.parent.name.replace ("%27", "'")); + window.toolbar.playback_box.set_artwork_image_image (current_episode.parent.coverart_uri); + track_changed (current_episode.title, current_episode.parent.name, current_episode.parent.coverart_uri, (uint64) player.duration); + settings.last_played_media = {current_episode.title, current_episode.parent.name}; + window.artwork_popover.set_notes_text (current_episode.description); + } catch (Error e) { + warning (e.message); + } + + window.toolbar.show_playback_box (); + } else { + window.toolbar.hide_playback_box (); + } + } + + public Episode get_episode () { + return current_episode; + } + /* * Playback related methods */ diff --git a/src/MainWindow.vala b/src/MainWindow.vala index b70d1d9..09475d1 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -642,27 +642,8 @@ namespace Vocal { // Attempt to find the matching episode, set it as the current episode, and display the information in the box foreach (Episode episode in podcast.episodes) { if (episode.title == fields[0]) { - controller.current_episode = episode; - toolbar.playback_box.set_info_title (controller.current_episode.title.replace ("%27", "'"), controller.current_episode.parent.name.replace ("%27", "'")); - toolbar.playback_box.set_artwork_image_image (controller.current_episode.parent.coverart_uri); - controller.track_changed (controller.current_episode.title, controller.current_episode.parent.name, controller.current_episode.parent.coverart_uri, (uint64) controller.player.duration); - - try { - - controller.player.set_episode (controller.current_episode); - controller.player.restore_position_episode = controller.current_episode; - artwork_popover.set_notes_text (episode.description); - - } catch (Error e) { - warning (e.message); - } - - if (controller.current_episode.last_played_position != 0) { - toolbar.show_playback_box (); - } - else { - toolbar.hide_playback_box (); - } + controller.set_episode (episode); + controller.player.restore_position_episode = episode; } } } @@ -773,16 +754,11 @@ namespace Vocal { */ private void play_episode_from_queue_immediately (Episode e) { - controller.current_episode = e; - artwork_popover.queue_box.hide (); + controller.set_episode (e); + artwork_popover.hide (); controller.library.remove_episode_from_queue (e); controller.play (); - - // Set the shownotes, the media information, and update the last played media in the settings - controller.track_changed (controller.current_episode.title, controller.current_episode.parent.name, controller.current_episode.parent.coverart_uri, (uint64)controller.player.duration); - artwork_popover.set_notes_text (controller.current_episode.description); - controller.settings.last_played_media = {controller.current_episode.title, controller.current_episode.parent.name}; } /* @@ -792,19 +768,13 @@ namespace Vocal { // Get the episode if (episode == null) { - controller.current_episode = details.current_episode; + controller.set_episode (details.current_episode); } else { - controller.current_episode = episode; + controller.set_episode (episode); } controller.player.pause (); controller.play (); - - // Set the shownotes, the media information, and update the last played media in the settings - controller.track_changed (controller.current_episode.title, controller.current_episode.parent.name, controller.current_episode.parent.coverart_uri, (uint64) controller.player.duration); - toolbar.playback_box.set_artwork_image_image (controller.current_episode.parent.coverart_uri); - artwork_popover.set_notes_text (controller.current_episode.description); - controller.settings.last_played_media = {controller.current_episode.title, controller.current_episode.parent.name}; } /* @@ -1025,9 +995,9 @@ namespace Vocal { controller.currently_importing = false; if (controller.player.playing) { - toolbar.playback_box.set_info_title (controller.current_episode.title.replace ("%27", "'"), controller.current_episode.parent.name.replace ("%27", "'")); - toolbar.playback_box.set_artwork_image_image (controller.current_episode.parent.coverart_uri); - video_controls.set_info_title (controller.current_episode.title.replace ("%27", "'"), controller.current_episode.parent.name.replace ("%27", "'")); + toolbar.playback_box.set_info_title (controller.get_episode ().title.replace ("%27", "'"), controller.get_episode ().parent.name.replace ("%27", "'")); + toolbar.playback_box.set_artwork_image_image (controller.get_episode ().parent.coverart_uri); + video_controls.set_info_title (controller.get_episode ().title.replace ("%27", "'"), controller.get_episode ().parent.name.replace ("%27", "'")); } loop.quit (); @@ -1141,7 +1111,7 @@ namespace Vocal { info ("GStreamer registry updated, attempting to start playback using the new plugins..."); // Reset the controller.player - controller.player.current_episode = null; + controller.set_episode (null); controller.play (); } @@ -1237,7 +1207,7 @@ namespace Vocal { details.on_single_delete(episode); // Update gpodder.net - controller.gpodder_client.update_episode (controller.current_episode, EpisodeAction.DELETE); + controller.gpodder_client.update_episode (controller.get_episode (), EpisodeAction.DELETE); } @@ -1639,7 +1609,7 @@ namespace Vocal { toolbar.set_play_pause_image (playpause_image); // If there is a video showing, return to the controller.library view - if (controller.current_episode.parent.content_type == MediaType.VIDEO) { + if (controller.get_episode ().parent.content_type == MediaType.VIDEO) { on_return_to_library (); } @@ -1648,16 +1618,10 @@ namespace Vocal { controller.playback_status_changed ("Stopped"); - controller.current_episode = controller.library.get_next_episode_in_queue (); - - if (controller.current_episode != null) { + controller.set_episode (controller.library.get_next_episode_in_queue ()); + if (controller.get_episode () != null) { controller.play (); - - // Set the shownotes, the media information, and update the last played media in the settings - controller.track_changed (controller.current_episode.title, controller.current_episode.parent.name, controller.current_episode.parent.coverart_uri, (uint64) controller.player.duration); - artwork_popover.set_notes_text (controller.current_episode.description); - controller.settings.last_played_media = {controller.current_episode.title, controller.current_episode.parent.name}; } else { controller.player.playing = false; controller.settings.last_played_media = null; @@ -1811,7 +1775,7 @@ namespace Vocal { } // Update gpodder.net if necessary - controller.gpodder_client.update_episode (controller.current_episode, EpisodeAction.PLAY); + controller.gpodder_client.update_episode (controller.get_episode (), EpisodeAction.PLAY); // If an episode is currently playing and Vocal is set to keep playing in the background, hide the window if (controller.player.playing && controller.settings.keep_playing_in_background) { From 1e4e7a6d49494aa39aa25ac668b86c304e5ce2d7 Mon Sep 17 00:00:00 2001 From: Bernhard Gebetsberger Date: Sun, 5 Apr 2020 02:22:53 +0200 Subject: [PATCH 25/39] Select first episode when queuing all new episodes in case current_episode is null --- src/MainWindow.vala | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/MainWindow.vala b/src/MainWindow.vala index 09475d1..6516af6 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -330,7 +330,11 @@ namespace Vocal { }); new_episodes_view.add_all_new_to_queue.connect ((episodes) => { foreach (Episode e in episodes) { - enqueue_episode (e); + if (controller.get_episode () == null) { + controller.set_episode (e); + } else { + enqueue_episode (e); + } } }); From 771b94d21c53eb83eaabedf739dd299487a4c292 Mon Sep 17 00:00:00 2001 From: Bernhard Gebetsberger Date: Tue, 7 Apr 2020 15:52:58 +0200 Subject: [PATCH 26/39] Change default library location key --- com.github.needleandthread.vocal.gschema.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.github.needleandthread.vocal.gschema.xml b/com.github.needleandthread.vocal.gschema.xml index 6d057fc..7a3da90 100644 --- a/com.github.needleandthread.vocal.gschema.xml +++ b/com.github.needleandthread.vocal.gschema.xml @@ -67,7 +67,7 @@ - "~/vocal" + "~/.local/share/vocal" The directory where podcasts are stored The directory where podcasts are stored From 362302d483eeaa773fccc02e2679bd03753de2f9 Mon Sep 17 00:00:00 2001 From: Bernhard Gebetsberger Date: Wed, 8 Apr 2020 22:29:03 +0200 Subject: [PATCH 27/39] Restore last episode after MPRIS has been initialized --- src/Controller.vala | 30 ++++++++++++++++++++++++++++++ src/MainWindow.vala | 33 --------------------------------- src/Utils/MPRIS.vala | 3 +++ 3 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/Controller.vala b/src/Controller.vala index 4eacb7b..d0fae0a 100644 --- a/src/Controller.vala +++ b/src/Controller.vala @@ -110,6 +110,9 @@ namespace Vocal { MPRIS mpris = new MPRIS (this); mpris.initialize (); + // Restore last played Episode after MPRIS has been initialized + mpris.initialized.connect (restore_episode); + // Connect the new player position available signal from the player // to set the new progress on the playback box @@ -387,6 +390,33 @@ namespace Vocal { return current_episode; } + private void restore_episode () { + if (settings.last_played_media != null && settings.last_played_media.length > 1) { + + info ("Restoring last played media."); + + // Split the media into two different strings + string[] fields = settings.last_played_media; + bool found = false; + foreach (Podcast podcast in library.podcasts) { + + if (!found) { + if (podcast.name == fields[1]) { + found = true; + + // Attempt to find the matching episode, set it as the current episode, and display the information in the box + foreach (Episode episode in podcast.episodes) { + if (episode.title == fields[0]) { + set_episode (episode); + player.restore_position_episode = episode; + } + } + } + } + } + } + } + /* * Playback related methods */ diff --git a/src/MainWindow.vala b/src/MainWindow.vala index 6516af6..fea8ca6 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -624,39 +624,6 @@ namespace Vocal { all_art.clear (); } - //TODO: Move this to the controller - - info ("Restoring last played media."); - // If the program was just launched, check to see what the last played media was - if (controller.newly_launched) { - - current_widget = all_scrolled; - - if (controller.settings.last_played_media != null && controller.settings.last_played_media.length > 1) { - - // Split the media into two different strings - string[] fields = controller.settings.last_played_media; - bool found = false; - foreach (Podcast podcast in controller.library.podcasts) { - - if (!found) { - if (podcast.name == fields[1]) { - found = true; - - // Attempt to find the matching episode, set it as the current episode, and display the information in the box - foreach (Episode episode in podcast.episodes) { - if (episode.title == fields[0]) { - controller.set_episode (episode); - controller.player.restore_position_episode = episode; - } - } - } - } - } - } - } - - // Refill the controller.library based on what is stored in the database (if it's not newly launched, in // which case it has already been filled) if (!controller.newly_launched) { diff --git a/src/Utils/MPRIS.vala b/src/Utils/MPRIS.vala index c0ef071..2b10ce5 100644 --- a/src/Utils/MPRIS.vala +++ b/src/Utils/MPRIS.vala @@ -40,6 +40,8 @@ namespace Vocal { private unowned DBusConnection conn; private uint owner_id; + public signal void initialized (); + /* * Default constructor that simply sets the controller.window */ @@ -109,6 +111,7 @@ namespace Vocal { }); connection.register_object ("/org/mpris/MediaPlayer2", player); + initialized (); } From 07abd6b2c12725297dee2c5ee1d4b45a653c2c00 Mon Sep 17 00:00:00 2001 From: Bernhard Gebetsberger Date: Thu, 9 Apr 2020 11:53:33 +0200 Subject: [PATCH 28/39] Filter

tag in podcast description --- src/Utils/FeedParser.vala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Utils/FeedParser.vala b/src/Utils/FeedParser.vala index 884cccc..253b077 100644 --- a/src/Utils/FeedParser.vala +++ b/src/Utils/FeedParser.vala @@ -93,7 +93,8 @@ namespace Vocal { else if (current == "description" && found_main_description == false) { i++; - podcast.description = queue[i]; + Regex p = new Regex (""); + podcast.description = p.replace (queue[i], -1, 0, ""); found_main_description = true; i++; } From 4c31815afbe70fa29ae8cf03e6e95eb9a1557a5d Mon Sep 17 00:00:00 2001 From: Bernhard Gebetsberger Date: Thu, 9 Apr 2020 18:42:33 +0200 Subject: [PATCH 29/39] Fix library location path --- src/Library.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Library.vala b/src/Library.vala index 8f5e015..21da2ba 100644 --- a/src/Library.vala +++ b/src/Library.vala @@ -1231,7 +1231,7 @@ namespace Vocal { if (settings.library_location == null) { settings.library_location = GLib.Environment.get_user_data_dir () + """/vocal"""; } - local_library_path = settings.library_location.replace ("~", GLib.Environment.get_user_data_dir ()); + local_library_path = settings.library_location.replace ("~", GLib.Environment.get_home_dir ()); // If the new local_library_path has been modified, update the setting if (settings.library_location != local_library_path) { From 5fefd5059a8825fa4b0765a0353568a22a566c46 Mon Sep 17 00:00:00 2001 From: Bernhard Gebetsberger Date: Thu, 9 Apr 2020 23:53:49 +0200 Subject: [PATCH 30/39] Change default value of should_quit_immediately to make the setting "Keep playing after closing window" work + fix typo --- src/Controller.vala | 2 +- src/MainWindow.vala | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Controller.vala b/src/Controller.vala index d0fae0a..89697c0 100644 --- a/src/Controller.vala +++ b/src/Controller.vala @@ -47,7 +47,7 @@ namespace Vocal { public bool first_run = true; public bool newly_launched = true; - public bool should_quit_immediately = true; + public bool should_quit_immediately = false; public bool plugins_are_installing = false; public bool checking_for_updates = false; public bool is_closing = false; diff --git a/src/MainWindow.vala b/src/MainWindow.vala index fea8ca6..1f5747c 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -1754,7 +1754,7 @@ namespace Vocal { return true; } else if (downloads != null && downloads.downloads.size > 0) { //If there are downloads verify that the user wishes to exit and cancel the downloads - var downloads_active_dialog = new Gtk.MessageDialog (this, Gtk.DialogFlags.MODAL, Gtk.MessageType.WARNING, Gtk.ButtonsType.YES_NO, _ ("Vocal is currently downloading episodes. Exiting will cause the downloads to be canceled. Are you sure you want to exit?")); + var downloads_active_dialog = new Gtk.MessageDialog (this, Gtk.DialogFlags.MODAL, Gtk.MessageType.WARNING, Gtk.ButtonsType.YES_NO, _ ("Vocal is currently downloading episodes. Exiting will cause the downloads to be cancelled. Are you sure you want to exit?")); downloads_active_dialog.response.connect ((response_id) => { downloads_active_dialog.destroy (); if (response_id == Gtk.ResponseType.YES) { From 96f9a88602ba4044259ef0dc5c3b9a171f13acf9 Mon Sep 17 00:00:00 2001 From: Bernhard Gebetsberger Date: Fri, 10 Apr 2020 23:56:58 +0200 Subject: [PATCH 31/39] Minor iTunes + infobar improvements --- src/Controller.vala | 2 +- src/MainWindow.vala | 12 +++++++----- src/Widgets/DirectoryView.vala | 1 + 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/Controller.vala b/src/Controller.vala index 89697c0..144c157 100644 --- a/src/Controller.vala +++ b/src/Controller.vala @@ -597,10 +597,10 @@ namespace Vocal { }); loop.run (); + window.hide_infobar (); if (success) { - window.hide_infobar (); window.toolbar.playback_box.show_artwork_image (); window.toolbar.playback_box.show_volume_button (); diff --git a/src/MainWindow.vala b/src/MainWindow.vala index 1f5747c..062830c 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -1007,8 +1007,13 @@ namespace Vocal { */ public void switch_visible_page (Gtk.Widget widget) { - if (current_widget != widget) - previous_widget = current_widget; + if (current_widget != widget) { + if (current_widget == welcome) { + previous_widget = all_scrolled; + } else { + previous_widget = current_widget; + } + } if (widget == all_scrolled) { notebook.set_visible_child (all_scrolled); @@ -1689,9 +1694,6 @@ namespace Vocal { // Show the store if (index == 0) { switch_visible_page (directory_scrolled); - - // Set the controller.library as the previous widget for return_to_library to work - previous_widget = all_scrolled; } // Add a new feed diff --git a/src/Widgets/DirectoryView.vala b/src/Widgets/DirectoryView.vala index 8ebcd86..f9ba58f 100644 --- a/src/Widgets/DirectoryView.vala +++ b/src/Widgets/DirectoryView.vala @@ -135,6 +135,7 @@ namespace Vocal { info ("iterating over entries"); itunes_title.set_text ("Error when loading iTunes Top 100 Podcasts"); loading_box.set_no_show_all (true); + loading_box.hide (); return null; } From 3dc9ec3136f7a476e55610c512475e4e6da13689 Mon Sep 17 00:00:00 2001 From: Bernhard Gebetsberger Date: Sat, 11 Apr 2020 04:30:19 +0200 Subject: [PATCH 32/39] Improved handling of some HTML characters --- src/Utils/Utils.vala | 2 ++ src/Widgets/PodcastView.vala | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Utils/Utils.vala b/src/Utils/Utils.vala index 840bc89..ce02fe1 100644 --- a/src/Utils/Utils.vala +++ b/src/Utils/Utils.vala @@ -95,6 +95,8 @@ public class Utils { markup = original; } + markup = markup.replace (" ", " "); + markup = markup.replace ("'", "'"); markup = markup.replace ("&", "&"); // Simplify (keep only href attribute) & preserve anchor tags. diff --git a/src/Widgets/PodcastView.vala b/src/Widgets/PodcastView.vala index 6158f1d..76330ed 100644 --- a/src/Widgets/PodcastView.vala +++ b/src/Widgets/PodcastView.vala @@ -619,7 +619,7 @@ namespace Vocal { } name_label.set_text (podcast.name.replace ("%27", "'")); - description_label.set_text (podcast.description.replace ("""\n""", "")); + description_label.set_text (Utils.html_to_markup (podcast.description)); reset_episode_list (); populate_episodes (); From 597f2f0191dcc1f521c082d3d1dea4366c200854 Mon Sep 17 00:00:00 2001 From: Bernhard Gebetsberger Date: Sat, 11 Apr 2020 04:30:38 +0200 Subject: [PATCH 33/39] Revert "Filter

tag in podcast description" This reverts commit 07abd6b2c12725297dee2c5ee1d4b45a653c2c00. This commit isn't needed anymore because of the last commit. --- src/Utils/FeedParser.vala | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Utils/FeedParser.vala b/src/Utils/FeedParser.vala index 253b077..884cccc 100644 --- a/src/Utils/FeedParser.vala +++ b/src/Utils/FeedParser.vala @@ -93,8 +93,7 @@ namespace Vocal { else if (current == "description" && found_main_description == false) { i++; - Regex p = new Regex (""); - podcast.description = p.replace (queue[i], -1, 0, ""); + podcast.description = queue[i]; found_main_description = true; i++; } From 06323d91e136b03d9cd3f3e77fc7f89a6e0947ae Mon Sep 17 00:00:00 2001 From: Bernhard Gebetsberger Date: Sat, 11 Apr 2020 12:30:59 +0200 Subject: [PATCH 34/39] Remove unneeded code Playlist_button isn't being used anymore since there is a new PlaybackBox --- src/Controller.vala | 2 -- src/MainWindow.vala | 12 ------------ src/Widgets/Toolbar.vala | 26 -------------------------- 3 files changed, 40 deletions(-) diff --git a/src/Controller.vala b/src/Controller.vala index 144c157..425e7d7 100644 --- a/src/Controller.vala +++ b/src/Controller.vala @@ -618,8 +618,6 @@ namespace Vocal { gpodder_loop.run (); } - window.toolbar.show_playlist_button (); - if (!player.playing) window.toolbar.hide_playback_box (); diff --git a/src/MainWindow.vala b/src/MainWindow.vala index 062830c..348e2e2 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -470,7 +470,6 @@ namespace Vocal { toolbar.play_pause_selected.connect (controller.play_pause); toolbar.seek_forward_selected.connect (controller.seek_forward); toolbar.seek_backward_selected.connect (controller.seek_backward); - toolbar.playlist_button.clicked.connect (() => { artwork_popover.queue_box.show_all (); }); toolbar.store_selected.connect (() => { details.pane_should_hide (); @@ -905,13 +904,6 @@ namespace Vocal { //If the user selects a file, get the name and parse it if (decision == Gtk.ResponseType.ACCEPT || run_pending_import == true) { - toolbar.show_playback_box (); - - // Hide the shownotes button - toolbar.playback_box.hide_artwork_image (); - toolbar.playback_box.hide_volume_button (); - toolbar.hide_playlist_button (); - if (current_widget == welcome) { switch_visible_page (import_message_box); } @@ -953,10 +945,6 @@ namespace Vocal { // Make the refresh and export items sensitive now toolbar.export_item.sensitive = true; - toolbar.playback_box.show_artwork_image (); - toolbar.playback_box.show_volume_button (); - toolbar.show_playlist_button (); - if (current_widget == import_message_box) { switch_visible_page (all_scrolled); } diff --git a/src/Widgets/Toolbar.vala b/src/Widgets/Toolbar.vala index d554fd3..5ea084c 100644 --- a/src/Widgets/Toolbar.vala +++ b/src/Widgets/Toolbar.vala @@ -54,7 +54,6 @@ namespace Vocal { public Gtk.Button search_button; private Gtk.Button podcast_store_button; - public Gtk.Button playlist_button; public Gtk.Button new_episodes_button; public Gtk.MenuItem export_item; @@ -73,14 +72,6 @@ namespace Vocal { // Set the playback box in the middle of the HeaderBar playback_box.hexpand = true; - playlist_button = new Gtk.Button.from_icon_name ("media-playlist-consecutive-symbolic"); - playlist_button.tooltip_text = _ ("Coming up next"); - playlist_button.clicked.connect (() => { - playlist_selected (); - }); - playlist_button.relief = Gtk.ReliefStyle.NONE; - playlist_button.valign = Gtk.Align.CENTER; - if (on_elementary) { new_episodes_button = new Gtk.Button.from_icon_name ("help-about-symbolic", Gtk.IconSize.LARGE_TOOLBAR); new_episodes_button.relief = Gtk.ReliefStyle.NONE; @@ -396,7 +387,6 @@ namespace Vocal { } } - public void show_playback_box () { if (playback_box != null) { this.playback_box.no_show_all = false; @@ -405,22 +395,6 @@ namespace Vocal { } } - - - public void show_playlist_button () { - if (playlist_button != null) { - playlist_button.set_no_show_all (false); - playlist_button.show (); - } - } - - public void hide_playlist_button () { - if (playlist_button != null) { - playlist_button.set_no_show_all (true); - playlist_button.hide (); - } - } - public void hide_download_button () { if (download != null) { this.download.set_no_show_all (true); From 374734c790626b943b0854b8dc8d573f8a8799db Mon Sep 17 00:00:00 2001 From: Bernhard Gebetsberger Date: Sun, 12 Apr 2020 04:10:59 +0200 Subject: [PATCH 35/39] fix spacing --- src/Utils/FeedParser.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Utils/FeedParser.vala b/src/Utils/FeedParser.vala index 884cccc..af1036c 100644 --- a/src/Utils/FeedParser.vala +++ b/src/Utils/FeedParser.vala @@ -165,7 +165,7 @@ namespace Vocal { string typestring = queue[i].slice (0, 5); if (typestring == "audio" || typestring == "video") { - found_media = true; + found_media = true; } if (podcast.content_type == MediaType.UNKNOWN) { From 594f82ee8158f81857e89a7cf43e0e43eb965fd2 Mon Sep 17 00:00:00 2001 From: Bernhard Gebetsberger Date: Sun, 12 Apr 2020 19:49:04 +0200 Subject: [PATCH 36/39] Use unique identifiers for last played episode --- src/Controller.vala | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Controller.vala b/src/Controller.vala index 425e7d7..d72b066 100644 --- a/src/Controller.vala +++ b/src/Controller.vala @@ -374,7 +374,7 @@ namespace Vocal { window.toolbar.playback_box.set_info_title (current_episode.title.replace ("%27", "'"), current_episode.parent.name.replace ("%27", "'")); window.toolbar.playback_box.set_artwork_image_image (current_episode.parent.coverart_uri); track_changed (current_episode.title, current_episode.parent.name, current_episode.parent.coverart_uri, (uint64) player.duration); - settings.last_played_media = {current_episode.title, current_episode.parent.name}; + settings.last_played_media = {current_episode.guid, current_episode.link, current_episode.podcast_uri}; window.artwork_popover.set_notes_text (current_episode.description); } catch (Error e) { warning (e.message); @@ -391,7 +391,7 @@ namespace Vocal { } private void restore_episode () { - if (settings.last_played_media != null && settings.last_played_media.length > 1) { + if (settings.last_played_media != null && settings.last_played_media.length > 2) { info ("Restoring last played media."); @@ -401,12 +401,12 @@ namespace Vocal { foreach (Podcast podcast in library.podcasts) { if (!found) { - if (podcast.name == fields[1]) { + if (podcast.feed_uri == fields[2]) { found = true; // Attempt to find the matching episode, set it as the current episode, and display the information in the box foreach (Episode episode in podcast.episodes) { - if (episode.title == fields[0]) { + if (episode.guid == fields[0] && episode.link == fields[1]) { set_episode (episode); player.restore_position_episode = episode; } From a98e437c0d3422f162450a6acde9e55352df99c7 Mon Sep 17 00:00:00 2001 From: Bernhard Gebetsberger Date: Tue, 14 Apr 2020 17:04:07 +0200 Subject: [PATCH 37/39] make iTunes status labels translatable --- src/Widgets/DirectoryView.vala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Widgets/DirectoryView.vala b/src/Widgets/DirectoryView.vala index f9ba58f..8a45228 100644 --- a/src/Widgets/DirectoryView.vala +++ b/src/Widgets/DirectoryView.vala @@ -103,7 +103,7 @@ namespace Vocal { loading_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 5); var spinner = new Gtk.Spinner (); spinner.active = true; - loading_label = new Gtk.Label (_ ("Loading iTunes Store (0 / 100)")); + loading_label = new Gtk.Label (_("Loading iTunes Store (%d / 100)".printf (0))); loading_label.get_style_context ().add_class ("h2"); loading_box.add (loading_label); loading_box.add (spinner); @@ -133,7 +133,7 @@ namespace Vocal { int i = 1; if (entries == null) { info ("iterating over entries"); - itunes_title.set_text ("Error when loading iTunes Top 100 Podcasts"); + itunes_title.set_text (_("Error when loading iTunes Top 100 Podcasts")); loading_box.set_no_show_all (true); loading_box.hide (); return null; @@ -153,7 +153,7 @@ namespace Vocal { on_new_subscription (url); }); flowbox.add (directory_art); - loading_label.set_text ("Loading iTunes Store (%d / 100)".printf (i)); + loading_label.set_text (_("Loading iTunes Store (%d / 100)".printf (i))); i++; } From 569e88607bce525d2c84334be37bfa6e24faf477 Mon Sep 17 00:00:00 2001 From: Bernhard Gebetsberger Date: Sun, 19 Apr 2020 22:12:14 +0200 Subject: [PATCH 38/39] always restore episode position --- src/Controller.vala | 1 - src/Utils/Player.vala | 10 +++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Controller.vala b/src/Controller.vala index d72b066..f72658a 100644 --- a/src/Controller.vala +++ b/src/Controller.vala @@ -408,7 +408,6 @@ namespace Vocal { foreach (Episode episode in podcast.episodes) { if (episode.guid == fields[0] && episode.link == fields[1]) { set_episode (episode); - player.restore_position_episode = episode; } } } diff --git a/src/Utils/Player.vala b/src/Utils/Player.vala index c550331..9fd70b7 100644 --- a/src/Utils/Player.vala +++ b/src/Utils/Player.vala @@ -40,7 +40,7 @@ namespace Vocal { private string tag_string; public Episode current_episode; - public Episode? restore_position_episode = null; + private bool restore_position; private Player (string[]? args) { @@ -50,9 +50,9 @@ namespace Vocal { // send a signal that there is a new position available GLib.Timeout.add (500, () => { if (playing && duration > 0.0) { - if (restore_position_episode == current_episode) { + if (restore_position) { set_position (current_episode.last_played_position); - restore_position_episode = null; + restore_position = false; } new_position_available (); } @@ -106,6 +106,10 @@ namespace Vocal { // Set the URI this.uri = episode.playback_uri; info ("Setting playback URI: %s".printf (episode.playback_uri)); + + if (current_episode.last_played_position > 0) { + restore_position = true; + } /* // If it's a video podcast, get the width and height and configure that information From f62a7224b686103ae836f353aef8015ebca76d43 Mon Sep 17 00:00:00 2001 From: Bernhard Gebetsberger Date: Mon, 20 Apr 2020 11:23:24 +0200 Subject: [PATCH 39/39] save episode position when switching episodes --- src/Controller.vala | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Controller.vala b/src/Controller.vala index f72658a..96511e1 100644 --- a/src/Controller.vala +++ b/src/Controller.vala @@ -367,6 +367,10 @@ namespace Vocal { } public void set_episode (Episode? e) { + if (current_episode != null) { + library.set_episode_playback_position (current_episode); + } + current_episode = e; if (current_episode != null) { try {