Skip to content
Snippets Groups Projects
Commit 4c7a2a4a authored by Geoffrey Métais's avatar Geoffrey Métais Committed by Geoffrey Métais
Browse files

Use LibVLC encoding for medialibrary

parent 2f42309b
No related branches found
No related tags found
1 merge request!436Use LibVLC encoding for medialibrary
Pipeline #13471 passed with stage
in 17 minutes and 37 seconds
......@@ -30,6 +30,7 @@ import androidx.annotation.Nullable;
import androidx.annotation.WorkerThread;
import org.videolan.libvlc.LibVLC;
import org.videolan.libvlc.util.VLCUtil;
import org.videolan.medialibrary.interfaces.Medialibrary;
import org.videolan.medialibrary.interfaces.media.Album;
import org.videolan.medialibrary.interfaces.media.Artist;
......@@ -118,7 +119,7 @@ public class MedialibraryImpl extends Medialibrary {
public boolean addDevice(@NonNull String uuid, @NonNull String path, boolean removable) {
if (!mIsInitiated) return false;
final boolean added = nativeAddDevice(Tools.encodeVLCString(uuid), Tools.encodeVLCMrl(path), removable);
final boolean added = nativeAddDevice(VLCUtil.encodeVLCString(uuid), Tools.encodeVLCMrl(path), removable);
synchronized (onDeviceChangeListeners) {
for (OnDeviceChangeListener listener : onDeviceChangeListeners) listener.onDeviceChange();
}
......@@ -146,7 +147,7 @@ public class MedialibraryImpl extends Medialibrary {
public boolean removeDevice(String uuid, String path) {
if (!mIsInitiated) return false;
final boolean removed = !TextUtils.isEmpty(uuid) && !TextUtils.isEmpty(path) && nativeRemoveDevice(Tools.encodeVLCString(uuid), Tools.encodeVLCMrl(path));
final boolean removed = !TextUtils.isEmpty(uuid) && !TextUtils.isEmpty(path) && nativeRemoveDevice(VLCUtil.encodeVLCString(uuid), Tools.encodeVLCMrl(path));
synchronized (onDeviceChangeListeners) {
for (OnDeviceChangeListener listener : onDeviceChangeListeners) listener.onDeviceChange();
}
......
......@@ -7,6 +7,7 @@ import android.text.TextUtils;
import androidx.annotation.Nullable;
import org.videolan.libvlc.util.VLCUtil;
import org.videolan.medialibrary.interfaces.media.MediaWrapper;
import org.videolan.medialibrary.media.MediaLibraryItem;
......@@ -133,13 +134,9 @@ public class Tools {
return sb.toString();
}
public static String encodeVLCString(String mrl) {
return Uri.encode(Uri.decode(mrl), ".-_~/()&!$*+,;='@:?");
}
public static String encodeVLCMrl(String mrl) {
if (mrl.startsWith("/")) mrl = "file://"+mrl;
return encodeVLCString(mrl);
return VLCUtil.encodeVLCString(mrl);
}
/**
......
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