Skip to content
This repository has been archived by the owner on Sep 2, 2024. It is now read-only.

Bug fixes & minor improvements #445

Open
wants to merge 40 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
f9068bc
Strip out weekday from Episode pubDate
Hanouta Mar 4, 2020
5ea1f43
Fix Regex to properly ignore <a href tags (#446)
sridhars Mar 27, 2020
e475f9e
Add gvfs to dependency list (#441)
Hanouta Mar 27, 2020
1219e0c
Infobar improvements when adding a podcast (#438)
Hanouta Mar 28, 2020
491d720
Fix GLib Errors
Hanouta Mar 10, 2020
defb812
Add Feeds/Episodes only if they contain an Audio/Video file
Hanouta Mar 11, 2020
e8a346a
Restore position of last played episode
Hanouta Mar 12, 2020
13446f9
Unset last_played_media when last Episode finished
Hanouta Mar 12, 2020
5fe4381
Fix formatting
Hanouta Mar 13, 2020
76fd1bb
I don't like tabs anymore
Hanouta Mar 13, 2020
dd02464
Export: Use CDATA instead of replacing characters
Hanouta Mar 13, 2020
4acbf42
Don't toggle elements of Toolbar when adding feeds
Hanouta Mar 14, 2020
429974d
Don't try to update gpodder when not logged in
Hanouta Mar 14, 2020
9f12eec
Fix crash when trying to play an Episode
Hanouta Mar 14, 2020
26d8b41
Fix to correctly restore episode position
Hanouta Mar 16, 2020
82d67e4
Use array instead of string to save last played media
Hanouta Mar 16, 2020
430310b
Fix height of iTunes search results
Hanouta Mar 31, 2020
b6ccc67
Increase max number of items per line
Hanouta Mar 31, 2020
598be90
Increase spacing in Headerbar
Hanouta Mar 31, 2020
962eda6
Fix two crashes after selecting multiple episodes
Hanouta Apr 2, 2020
8f2bfa4
Change libunity desktop id
Hanouta Apr 4, 2020
94fa3b0
Sort episodes by release date in SQL query
Hanouta Apr 4, 2020
c9145e7
Show status when loading iTunes Top 100
Hanouta Apr 4, 2020
2956e80
Code deduplication
Hanouta Apr 5, 2020
1e4e7a6
Select first episode when queuing all new episodes
Hanouta Apr 5, 2020
771b94d
Change default library location key
Hanouta Apr 7, 2020
362302d
Restore last episode after MPRIS has been initialized
Hanouta Apr 8, 2020
07abd6b
Filter <p> tag in podcast description
Hanouta Apr 9, 2020
4c31815
Fix library location path
Hanouta Apr 9, 2020
5fefd50
Change default value of should_quit_immediately
Hanouta Apr 9, 2020
96f9a88
Minor iTunes + infobar improvements
Hanouta Apr 10, 2020
3dc9ec3
Improved handling of some HTML characters
Hanouta Apr 11, 2020
597f2f0
Revert "Filter <p> tag in podcast description"
Hanouta Apr 11, 2020
06323d9
Remove unneeded code
Hanouta Apr 11, 2020
374734c
fix spacing
Hanouta Apr 12, 2020
594f82e
Use unique identifiers for last played episode
Hanouta Apr 12, 2020
a98e437
make iTunes status labels translatable
Hanouta Apr 14, 2020
569e886
always restore episode position
Hanouta Apr 19, 2020
f62a722
save episode position when switching episodes
Hanouta Apr 20, 2020
b4bf95b
Resolve merge conflicts
Hanouta Apr 6, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ libxml-2.0
granite
gtk+-3.0
gstreamer-1.0
gvfs
sqlite3


Expand Down
8 changes: 4 additions & 4 deletions com.github.needleandthread.vocal.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,18 @@
</key>

<key name="library-location" type="s">
<default>"~/vocal"</default>
<default>"~/.local/share/vocal"</default>
<summary>The directory where podcasts are stored</summary>
<description>
The directory where podcasts are stored
</description>
</key>

<key name="last-played-media" type="s">
<default>""</default>
<key name="last-played-media" type="as">
<default>[]</default>
<summary>The podcast and episode that was last playing</summary>
<description>
The podcast and episode that was last played, in podcast_name,episode_title format
The podcast and episode that was last played.
</description>
</key>

Expand Down
86 changes: 57 additions & 29 deletions src/Controller.vala
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ namespace Vocal {

public bool first_run = true;
public bool newly_launched = true;
public bool should_quit_immediately = true;
nathandyer marked this conversation as resolved.
Show resolved Hide resolved
public bool should_quit_immediately = false;
public bool plugins_are_installing = false;
public bool checking_for_updates = false;
public bool is_closing = false;
Expand All @@ -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 */
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -363,6 +366,57 @@ 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.guid, current_episode.link, current_episode.podcast_uri};
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;
}

private void restore_episode () {
if (settings.last_played_media != null && settings.last_played_media.length > 2) {

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.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.guid == fields[0] && episode.link == fields[1]) {
set_episode (episode);
player.restore_position_episode = episode;
}
}
}
}
}
}
}
nathandyer marked this conversation as resolved.
Show resolved Hide resolved

/*
* Playback related methods
*/
Expand Down Expand Up @@ -432,25 +486,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"));
Expand Down Expand Up @@ -546,13 +581,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: <b>" + feed + "</b>"), MessageType.INFO);
window.toolbar.show_playback_box ();

var loop = new MainLoop ();
bool success = false;
Expand All @@ -568,6 +597,7 @@ namespace Vocal {
});

loop.run ();
window.hide_infobar ();

if (success) {

Expand All @@ -588,8 +618,6 @@ namespace Vocal {
gpodder_loop.run ();
}

window.toolbar.show_playlist_button ();

if (!player.playing)
window.toolbar.hide_playback_box ();

Expand Down
14 changes: 9 additions & 5 deletions src/Library.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -717,8 +717,12 @@ namespace Vocal {
foreach (Podcast p in podcasts) {

output_line =
"""<outline text="%s" type="rss" xmlUrl="%s"/>
""".printf (p.name.replace ("\"", "'").replace ("&", "and"), p.feed_uri);
"""<outline>
<text><![CDATA[%s]]></text>
<type>rss</type>
<xmlUrl><![CDATA[%s]]></xmlUrl>
</outline>
""".printf (p.name, p.feed_uri);
stream.output_stream.write (output_line.data);
}

Expand Down Expand Up @@ -905,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 ());
Expand Down Expand Up @@ -1227,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) {
Expand Down
Loading