diff --git a/README.md b/README.md index 5bb94e1..ef69ccf 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,16 @@ # Byte -A music player without the library management. Just toss in your music to the playlist from your meticulously managed music folder. +Rediscover your music + +Interact with your music and fall in love with your library all over again. +Byte offers a beautiful presentation of your Music Library with loads of powerful features in a minimalistic yet highly customizable UI. + +## Handy features: +* Light and Dark themes. +* Add up to 100 items under "Recently Added" for songs. +* Sort individual playlists by album, title, play count or recently added. +* Advanced Media Details and Artist Info. +* Group Playlists, Albums, Artists, Songs, etc. +* Search, add and play your favorite online radio stations. Get it on AppCenter @@ -31,6 +42,6 @@ com.github.alainm23.byte ``` ## Donations -Stripe is not yet available in my country, If you like Planner and you want to support its development, consider donating via [PayPal](https://www.paypal.me/alainm23) +Stripe is not yet available in my country, If you like Planner and you want to support its development, consider donating via [Patreon](https://www.patreon.com/alainm23) Made with 💗 in Perú diff --git a/data/com.github.alainm23.byte.appdata.xml.in b/data/com.github.alainm23.byte.appdata.xml.in index 757de0c..9bc98ee 100644 --- a/data/com.github.alainm23.byte.appdata.xml.in +++ b/data/com.github.alainm23.byte.appdata.xml.in @@ -23,6 +23,11 @@ com.github.alainm23.byte ​ + + +

Fix some error and performance improvement

+
+

Initial release

@@ -78,6 +83,8 @@ Alain M. https://github.com/alainm23/byte https://github.com/alainm23/byte/issues + https://www.patreon.com/alainm23 + https://www.patreon.com/alainm23 #333333 #FE2851 diff --git a/meson.build b/meson.build index 79c2dfe..5339d52 100644 --- a/meson.build +++ b/meson.build @@ -1,6 +1,6 @@ project('com.github.alainm23.byte', 'vala', 'c', - version: '0.0.1') + version: '0.1.2') gnome = import('gnome') i18n = import('i18n') diff --git a/src/Application.vala b/src/Application.vala index ff84f35..cad5ddd 100644 --- a/src/Application.vala +++ b/src/Application.vala @@ -31,6 +31,7 @@ public class Byte : Gtk.Application { application_id: "com.github.alainm23.byte", flags: ApplicationFlags.HANDLES_OPEN ); + // Dir to Database utils = new Utils (); utils.create_dir_with_parents ("/.local/share/com.github.alainm23.byte"); diff --git a/src/Services/Database.vala b/src/Services/Database.vala index 59e8f50..5862490 100644 --- a/src/Services/Database.vala +++ b/src/Services/Database.vala @@ -1,5 +1,5 @@ public class Services.Database : GLib.Object { - private Sqlite.Database db; + private Sqlite.Database db; private string db_path; public signal void adden_new_track (Objects.Track track); diff --git a/src/Services/Scan.vala b/src/Services/Scan.vala index bf5b20f..a32f0d8 100644 --- a/src/Services/Scan.vala +++ b/src/Services/Scan.vala @@ -10,35 +10,42 @@ public class Services.Scan : GLib.Object { Byte.tg_manager.discovered_new_item.connect (discovered_new_local_item); Byte.database.adden_new_track.connect ((track) => { - counter--; - sync_progress (((double) counter_max - (double) counter) / (double) counter_max); - if (counter == 0) { - sync_finished (); - is_sync = false; - - Timeout.add (1 * 1000, () => { - Byte.notification.send_notification ( - _("Import Complete"), - _("Your Library Has Been Imported.") - ); - - if (counter_max > 1500) { - var message_dialog = new Granite.MessageDialog.with_image_from_icon_name ( - _("Wow! your library is very big"), - _("All your library was imported correctly, but for a better experience we recommend you re-open the application."), - "process-completed", - Gtk.ButtonsType.CLOSE + Idle.add (() => { + counter--; + sync_progress (((double) counter_max - (double) counter) / (double) counter_max); + if (counter == 0) { + sync_finished (); + is_sync = false; + counter_max = 0; + + /* + Timeout.add (1 * 1000, () => { + counter_max = 0; + + Byte.notification.send_notification ( + _("Import Complete"), + _("Your Library Has Been Imported.") ); + /* + if (counter_max > 1500) { + var message_dialog = new Granite.MessageDialog.with_image_from_icon_name ( + _("Wow! your library is very big"), + _("All your library was imported correctly, but for a better experience we recommend you re-open the application."), + "process-completed", + Gtk.ButtonsType.CLOSE + ); + + message_dialog.run (); + message_dialog.destroy (); + } - message_dialog.run (); - message_dialog.destroy (); - - counter_max = 0; - } - - return false; - }); - } + return false; + }); + */ + } + + return false; + }); }); } diff --git a/src/Views/Album.vala b/src/Views/Album.vala index f6f1e38..0bf7c31 100644 --- a/src/Views/Album.vala +++ b/src/Views/Album.vala @@ -214,24 +214,32 @@ public class Views.Album : Gtk.EventBox { }); Byte.database.adden_new_track.connect ((track) => { - if (_album != null && track.album_id == _album.id) { - var row = new Widgets.TrackAlbumRow (track); - listbox.add (row); - listbox.show_all (); - } + Idle.add (() => { + if (_album != null && track.album_id == _album.id) { + var row = new Widgets.TrackAlbumRow (track); + listbox.add (row); + listbox.show_all (); + } + + return false; + }); }); Byte.database.updated_album_cover.connect ((album_id) => { - if (_album != null && album_id == _album.id) { - try { - image_cover.pixbuf = new Gdk.Pixbuf.from_file_at_size ( - GLib.Path.build_filename (Byte.utils.COVER_FOLDER, ("album-%i.jpg").printf (album_id)), - 128, - 128); - } catch (Error e) { - stderr.printf ("Error setting default avatar icon: %s ", e.message); + Idle.add (() => { + if (_album != null && album_id == _album.id) { + try { + image_cover.pixbuf = new Gdk.Pixbuf.from_file_at_size ( + GLib.Path.build_filename (Byte.utils.COVER_FOLDER, ("album-%i.jpg").printf (album_id)), + 128, + 128); + } catch (Error e) { + stderr.printf ("Error setting default avatar icon: %s ", e.message); + } } - } + + return false; + }); }); Byte.database.reset_library.connect (() => { diff --git a/src/Views/Playlists.vala b/src/Views/Playlists.vala index 438b6a4..95a9c42 100644 --- a/src/Views/Playlists.vala +++ b/src/Views/Playlists.vala @@ -116,6 +116,14 @@ public class Views.Playlists : Gtk.EventBox { widget.destroy (); }); }); + + Byte.scan_service.sync_started.connect (() => { + add_button.sensitive = false; + }); + + Byte.scan_service.sync_finished.connect (() => { + add_button.sensitive = true; + }); } private void add_item (Objects.Playlist playlist) { diff --git a/src/Widgets/AlbumRow.vala b/src/Widgets/AlbumRow.vala index a1e306e..4e95756 100644 --- a/src/Widgets/AlbumRow.vala +++ b/src/Widgets/AlbumRow.vala @@ -76,16 +76,20 @@ public class Widgets.AlbumRow : Gtk.ListBoxRow { add (main_grid); Byte.database.updated_album_cover.connect ((album_id) => { - if (album_id == album.id) { - try { - image_cover.pixbuf = new Gdk.Pixbuf.from_file_at_size ( - GLib.Path.build_filename (Byte.utils.COVER_FOLDER, ("album-%i.jpg").printf (album_id)), - 64, - 64); - } catch (Error e) { - stderr.printf ("Error setting default avatar icon: %s ", e.message); + Idle.add (() => { + if (album_id == album.id) { + try { + image_cover.pixbuf = new Gdk.Pixbuf.from_file_at_size ( + GLib.Path.build_filename (Byte.utils.COVER_FOLDER, ("album-%i.jpg").printf (album_id)), + 64, + 64); + } catch (Error e) { + stderr.printf ("Error setting default avatar icon: %s ", e.message); + } } - } + + return false; + }); }); } } \ No newline at end of file diff --git a/src/Widgets/MediaControl.vala b/src/Widgets/MediaControl.vala index bc361c8..baaf9da 100644 --- a/src/Widgets/MediaControl.vala +++ b/src/Widgets/MediaControl.vala @@ -179,16 +179,20 @@ public class Widgets.MediaControl : Gtk.Revealer { }); Byte.database.updated_track_cover.connect ((track_id) => { - if (Byte.player.current_track != null && track_id == Byte.player.current_track.id) { - try { - image_cover.pixbuf = new Gdk.Pixbuf.from_file_at_size ( - GLib.Path.build_filename (Byte.utils.COVER_FOLDER, ("track-%i.jpg").printf (track_id)), - 32, - 32); - } catch (Error e) { - stderr.printf ("Error setting default avatar icon: %s ", e.message); + Idle.add (() => { + if (Byte.player.current_track != null && track_id == Byte.player.current_track.id) { + try { + image_cover.pixbuf = new Gdk.Pixbuf.from_file_at_size ( + GLib.Path.build_filename (Byte.utils.COVER_FOLDER, ("track-%i.jpg").printf (track_id)), + 32, + 32); + } catch (Error e) { + stderr.printf ("Error setting default avatar icon: %s ", e.message); + } } - } + + return false; + }); }); timeline.scale.change_value.connect ((scroll, new_value) => { diff --git a/src/Widgets/TrackAlbumRow.vala b/src/Widgets/TrackAlbumRow.vala index 640fb8b..a1d7f5c 100644 --- a/src/Widgets/TrackAlbumRow.vala +++ b/src/Widgets/TrackAlbumRow.vala @@ -149,27 +149,29 @@ public class Widgets.TrackAlbumRow : Gtk.ListBoxRow { child.destroy (); } - var all_items = Byte.database.get_all_playlists (); - - var item = new Gtk.MenuItem.with_label (_ ("Create New Playlist")); - item.get_style_context ().add_class ("track-options"); - item.get_style_context ().add_class ("css-item"); - item.activate.connect (() => { - //var new_playlist = library_manager.create_new_playlist (); - //library_manager.add_track_into_playlist (new_playlist, track.ID); - }); - //playlists.add (item); + if (Byte.scan_service.is_sync == false) { + var all_items = Byte.database.get_all_playlists (); - foreach (var playlist in all_items) { - item = new Gtk.MenuItem.with_label (playlist.title); + var item = new Gtk.MenuItem.with_label (_ ("Create New Playlist")); item.get_style_context ().add_class ("track-options"); item.get_style_context ().add_class ("css-item"); item.activate.connect (() => { - Byte.database.insert_track_into_playlist (playlist, track.id); + //var new_playlist = library_manager.create_new_playlist (); + //library_manager.add_track_into_playlist (new_playlist, track.ID); }); - playlists.add (item); + //playlists.add (item); + + foreach (var playlist in all_items) { + item = new Gtk.MenuItem.with_label (playlist.title); + item.get_style_context ().add_class ("track-options"); + item.get_style_context ().add_class ("css-item"); + item.activate.connect (() => { + Byte.database.insert_track_into_playlist (playlist, track.id); + }); + playlists.add (item); + } + playlists.show_all (); } - playlists.show_all (); menu.popup_at_pointer (null); } diff --git a/src/Widgets/TrackRow.vala b/src/Widgets/TrackRow.vala index 2c25f88..6b299be 100644 --- a/src/Widgets/TrackRow.vala +++ b/src/Widgets/TrackRow.vala @@ -163,16 +163,20 @@ public class Widgets.TrackRow : Gtk.ListBoxRow { }); Byte.database.updated_track_cover.connect ((track_id) => { - if (track_id == track.id) { - try { - image_cover.pixbuf = new Gdk.Pixbuf.from_file_at_size ( - GLib.Path.build_filename (Byte.utils.COVER_FOLDER, ("track-%i.jpg").printf (track_id)), - 32, - 32); - } catch (Error e) { - stderr.printf ("Error setting default avatar icon: %s ", e.message); + Idle.add (() => { + if (track_id == track.id) { + try { + image_cover.pixbuf = new Gdk.Pixbuf.from_file_at_size ( + GLib.Path.build_filename (Byte.utils.COVER_FOLDER, ("track-%i.jpg").printf (track_id)), + 32, + 32); + } catch (Error e) { + stderr.printf ("Error setting default avatar icon: %s ", e.message); + } } - } + + return false; + }); }); Byte.database.updated_track_favorite.connect ((_track, favorite) => { @@ -231,27 +235,29 @@ public class Widgets.TrackRow : Gtk.ListBoxRow { child.destroy (); } - var all_items = Byte.database.get_all_playlists (); + if (Byte.scan_service.is_sync == false) { + var all_items = Byte.database.get_all_playlists (); - var item = new Gtk.MenuItem.with_label (_ ("Create New Playlist")); - item.get_style_context ().add_class ("track-options"); - item.get_style_context ().add_class ("css-item"); - item.activate.connect (() => { - //var new_playlist = library_manager.create_new_playlist (); - //library_manager.add_track_into_playlist (new_playlist, track.ID); - }); - //playlists.add (item); - - foreach (var playlist in all_items) { - item = new Gtk.MenuItem.with_label (playlist.title); + var item = new Gtk.MenuItem.with_label (_ ("Create New Playlist")); item.get_style_context ().add_class ("track-options"); item.get_style_context ().add_class ("css-item"); item.activate.connect (() => { - Byte.database.insert_track_into_playlist (playlist, track.id); + //var new_playlist = library_manager.create_new_playlist (); + //library_manager.add_track_into_playlist (new_playlist, track.ID); }); - playlists.add (item); + //playlists.add (item); + + foreach (var playlist in all_items) { + item = new Gtk.MenuItem.with_label (playlist.title); + item.get_style_context ().add_class ("track-options"); + item.get_style_context ().add_class ("css-item"); + item.activate.connect (() => { + Byte.database.insert_track_into_playlist (playlist, track.id); + }); + playlists.add (item); + } + playlists.show_all (); } - playlists.show_all (); menu.popup_at_pointer (null); }