Skip to content
Snippets Groups Projects
Commit 6d69478d authored by Geoffrey Métais's avatar Geoffrey Métais
Browse files

Add external media to playlists

parent e238abb8
No related branches found
No related tags found
No related merge requests found
......@@ -148,16 +148,32 @@ public class SavePlaylistDialog extends DialogFragment implements View.OnClickLi
if (addTracks) {
if (!exists)
playlist = mMedialibrary.createPlaylist(name);
ids = new long[mTracks.size()];
for (int i = 0 ; i < mNewTrack.size(); ++i)
ids = new long[mNewTrack.size()];
for (int i = 0 ; i < mNewTrack.size(); ++i) {
ids[i] = mNewTrack.get(i).getId();
if (ids[i] == 0) {
MediaWrapper media = mMedialibrary.getMedia(mNewTrack.get(i).getLocation());
if (media != null && media.getId() != 0)
ids[i] = media.getId();
else
ids[i] = mMedialibrary.addMedia(mNewTrack.get(i).getLocation()).getId();
}
}
} else { //Save a playlist
if (exists)
playlist.delete(mMedialibrary);
playlist = mMedialibrary.createPlaylist(name);
ids = new long[mTracks.size()];
for (int i = 0; i < mTracks.size(); ++i)
for (int i = 0; i < mTracks.size(); ++i) {
ids[i] = mTracks.get(i).getId();
if (ids[i] == 0) {
MediaWrapper media = mMedialibrary.getMedia(mNewTrack.get(i).getLocation());
if (media != null && media.getId() != 0)
ids[i] = media.getId();
else
ids[i] = mMedialibrary.addMedia(mNewTrack.get(i).getLocation()).getId();
}
}
}
playlist.append(mMedialibrary, ids);
if (mCallBack != null)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment