Commit a1a3e349 authored by Geoffrey Métais's avatar Geoffrey Métais

MediaParsingService only discovers new device

Device adding is automated
parent 130c1b52
......@@ -119,18 +119,16 @@ public class MediaParsingService extends Service implements DevicesDiscoveryCb {
discover(intent.getStringExtra(EXTRA_PATH));
break;
case ACTION_DISCOVER_DEVICE:
discoverStorage(intent.getStringExtra(EXTRA_PATH), intent.getStringExtra(EXTRA_UUID));
discoverStorage(intent.getStringExtra(EXTRA_PATH));
break;
}
return START_NOT_STICKY;
}
private void discoverStorage(final String path, final String uuid) {
private void discoverStorage(final String path) {
mThreadPool.execute(new Runnable() {
@Override
public void run() {
if (!TextUtils.isEmpty(uuid))
mMedialibrary.addDevice(uuid, path, true);
for (String folder : Medialibrary.getBlackList())
mMedialibrary.banFolder(path + folder);
mMedialibrary.discover(path);
......@@ -144,7 +142,6 @@ public class MediaParsingService extends Service implements DevicesDiscoveryCb {
mThreadPool.execute(new Runnable() {
@Override
public void run() {
addDeviceIfNeeded(path);
mMedialibrary.discover(path);
}
});
......
......@@ -67,7 +67,6 @@ public class DialogActivity extends BaseActivity {
ExternalStorageDialog dialog = new ExternalStorageDialog();
Bundle b = new Bundle(2);
b.putString(MediaParsingService.EXTRA_PATH, getIntent().getStringExtra(MediaParsingService.EXTRA_PATH));
b.putString(MediaParsingService.EXTRA_UUID, getIntent().getStringExtra(MediaParsingService.EXTRA_UUID));
dialog.setArguments(b);
dialog.show(getSupportFragmentManager(), "fragment_storage");
}
......
......@@ -37,8 +37,7 @@ public class ExternalStorageDialog extends AppCompatDialogFragment {
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
Intent serviceInent = new Intent(MediaParsingService.ACTION_DISCOVER_DEVICE, null, getActivity(), MediaParsingService.class)
.putExtra(MediaParsingService.EXTRA_PATH, path)
.putExtra(MediaParsingService.EXTRA_UUID, uuid);
.putExtra(MediaParsingService.EXTRA_PATH, path);
if (getActivity() != null) {
getActivity().startService(serviceInent);
getActivity().finish();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment