Skip to content

Commit 447e173

Browse files
author
Alain M
committed
fix ...
1 parent c8395f7 commit 447e173

19 files changed

+83
-57
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ A music player without the library management. Just toss in your music to the pl
44
![Byte Screenshot](https://github.com/alainm23/byte/raw/master/data/screenshot/screenshot-01.png)
55
![Byte Screenshot](https://github.com/alainm23/byte/raw/master/data/screenshot/screenshot-02.png)
66
![Byte Screenshot](https://github.com/alainm23/byte/raw/master/data/screenshot/screenshot-03.png)
7+
![Byte Screenshot](https://github.com/alainm23/byte/raw/master/data/screenshot/screenshot-04.png)
8+
![Byte Screenshot](https://github.com/alainm23/byte/raw/master/data/screenshot/screenshot-05.png)
79

810
## Building and Installation
911

data/com.github.alainm23.byte.appdata.xml.in

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@
3939
<screenshot>
4040
<image>https://raw.githubusercontent.com/alainm23/byte/master/data/screenshot/screenshot-03.png</image>
4141
</screenshot>
42+
<screenshot>
43+
<image>https://raw.githubusercontent.com/alainm23/byte/master/data/screenshot/screenshot-04.png</image>
44+
</screenshot>
45+
<screenshot>
46+
<image>https://raw.githubusercontent.com/alainm23/byte/master/data/screenshot/screenshot-05.png</image>
47+
</screenshot>
4248
</screenshots>
4349
<content_rating type="oars-1.1">
4450
<content_attribute id="violence-cartoon">none</content_attribute>

data/screenshot/screenshot-01.png

47.6 KB
Loading

data/screenshot/screenshot-02.png

51.6 KB
Loading

data/screenshot/screenshot-03.png

-73.7 KB
Loading

data/screenshot/screenshot-04.png

95.1 KB
Loading

data/screenshot/screenshot-05.png

106 KB
Loading

src/Services/Database.vala

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1351,6 +1351,31 @@ public class Services.Database : GLib.Object {
13511351
}
13521352
}
13531353

1354+
public bool remove_from_playlist (Objects.Track track) {
1355+
Sqlite.Statement stmt;
1356+
string sql;
1357+
int res;
1358+
1359+
sql = """
1360+
DELETE FROM playlist_tracks where track_id = ? AND playlist_id = ?;
1361+
""";
1362+
1363+
res = db.prepare_v2 (sql, -1, out stmt);
1364+
assert (res == Sqlite.OK);
1365+
1366+
res = stmt.bind_int (1, track.id);
1367+
assert (res == Sqlite.OK);
1368+
1369+
res = stmt.bind_int (2, track.playlist);
1370+
assert (res == Sqlite.OK);
1371+
1372+
if (stmt.step () == Sqlite.DONE) {
1373+
return true;
1374+
} else {
1375+
return false;
1376+
}
1377+
}
1378+
13541379
public void reset_all_library () {
13551380
File db_path = File.new_for_path (db_path);
13561381
try {

src/Utils.vala

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,31 +14,25 @@ public class Utils : GLib.Object {
1414
COVER_FOLDER = GLib.Path.build_filename (MAIN_FOLDER, "covers");
1515
}
1616

17-
public void set_items (Gee.ArrayList<Objects.Track?> all_items, bool shuffle_mode, Objects.Track? track) {
18-
/*
19-
print ("-------------------\n");
20-
foreach (var item in queue_playlist) {
21-
print ("Track: %s\n".printf (item.title));
22-
}
23-
print ("--------------------\n");
24-
*/
25-
26-
if (shuffle_mode) {
27-
queue_playlist = generate_shuffle (all_items);
28-
29-
if (track != null) {
30-
int index = get_track_index_by_id (track.id, queue_playlist);
31-
queue_playlist.remove_at (index);
32-
queue_playlist.insert (0, track);
17+
public void set_items (Gee.ArrayList<Objects.Track?> all_items, bool shuffle_mode, Objects.Track? track) {
18+
if (all_items.size > 0) {
19+
if (shuffle_mode) {
20+
queue_playlist = generate_shuffle (all_items);
21+
22+
if (track != null) {
23+
int index = get_track_index_by_id (track.id, queue_playlist);
24+
queue_playlist.remove_at (index);
25+
queue_playlist.insert (0, track);
26+
}
27+
28+
Byte.settings.set_boolean ("shuffle-mode", true);
29+
} else {
30+
queue_playlist = playlist_order (all_items);
31+
Byte.settings.set_boolean ("shuffle-mode", false);
3332
}
3433

35-
Byte.settings.set_boolean ("shuffle-mode", true);
36-
} else {
37-
queue_playlist = playlist_order (all_items);
38-
Byte.settings.set_boolean ("shuffle-mode", false);
39-
}
40-
41-
play_items (queue_playlist, track);
34+
play_items (queue_playlist, track);
35+
}
4236
}
4337

4438
public void shuffle_changed (bool shuffle_mode) {

src/Views/Album.vala

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,6 @@ public class Views.Album : Gtk.EventBox {
137137

138138
var action_grid = new Gtk.Grid ();
139139
action_grid.margin = 6;
140-
action_grid.margin_start = 12;
141-
action_grid.margin_end = 12;
142140
action_grid.column_spacing = 12;
143141
action_grid.add (play_button);
144142
action_grid.add (shuffle_button);
@@ -153,20 +151,16 @@ public class Views.Album : Gtk.EventBox {
153151

154152
var album_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 6);
155153
album_box.hexpand = true;
156-
album_box.margin = 12;
157-
album_box.margin_bottom = 6;
158-
album_box.margin_top = 12;
154+
album_box.margin = 6;
159155
album_box.pack_start (image_cover, false, false, 0);
160156
album_box.pack_start (detail_box, false, false, 0);
161157

162158
listbox = new Gtk.ListBox ();
163159
listbox.expand = true;
164-
listbox.margin_start = 9;
165-
listbox.margin_end = 9;
166160

167161
var separator = new Gtk.Separator (Gtk.Orientation.HORIZONTAL);
168-
separator.margin_start = 14;
169-
separator.margin_end = 9;
162+
separator.margin_start = 6;
163+
separator.margin_end = 6;
170164

171165
var scrolled_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
172166
scrolled_box.expand = true;

0 commit comments

Comments
 (0)