Browse Source

- general cleanup and polish of code

- removed commented out stuff
- added some comments here and there
- renamed "files" to "items" in remote rss related stuff
- display error message if fails to download torrent via remote rss
pull/313/head
twig 9 years ago
parent
commit
8ad8d0d39a
  1. 3
      app/src/main/java/org/transdroid/core/gui/remoterss/RemoteRssActivity.java
  2. 10
      app/src/main/java/org/transdroid/core/gui/remoterss/RemoteRssFilesAdapter.java
  3. 38
      app/src/main/java/org/transdroid/core/gui/remoterss/RemoteRssFragment.java
  4. 6
      app/src/main/java/org/transdroid/core/gui/remoterss/RemoteRssItemView.java
  5. 6
      app/src/main/java/org/transdroid/core/gui/remoterss/data/RemoteRssChannel.java
  6. 2
      app/src/main/java/org/transdroid/core/gui/remoterss/data/RemoteRssItem.java
  7. 10
      app/src/main/java/org/transdroid/daemon/Utorrent/UtorrentAdapter.java
  8. 92
      app/src/main/java/org/transdroid/daemon/Utorrent/data/UTorrentRemoteRssChannel.java
  9. 5
      app/src/main/java/org/transdroid/daemon/Utorrent/data/UTorrentRemoteRssItem.java
  10. 2
      app/src/main/res/layout/activity_remoterss.xml
  11. 1
      app/src/main/res/menu/activity_torrents_main.xml
  12. 3
      app/src/main/res/values/strings.xml

3
app/src/main/java/org/transdroid/core/gui/remoterss/RemoteRssActivity.java

@ -60,7 +60,6 @@ import java.util.List;
* @author Eric Kok * @author Eric Kok
*/ */
@EActivity(R.layout.activity_remoterss) @EActivity(R.layout.activity_remoterss)
//@OptionsMenu(R.menu.activity_details)
public class RemoteRssActivity extends AppCompatActivity { public class RemoteRssActivity extends AppCompatActivity {
@Extra @Extra
@InstanceState @InstanceState
@ -113,7 +112,6 @@ public class RemoteRssActivity extends AppCompatActivity {
torrentsToolbar.setNavigationIcon(R.drawable.ic_action_drawer); torrentsToolbar.setNavigationIcon(R.drawable.ic_action_drawer);
setSupportActionBar(torrentsToolbar); setSupportActionBar(torrentsToolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
// getSupportActionBar().setTitle(NavigationHelper.buildCondensedFontString(torrent.getName()));
// Connect to the last used server // Connect to the last used server
ServerSetting lastUsed = applicationSettings.getLastUsedServer(); ServerSetting lastUsed = applicationSettings.getLastUsedServer();
@ -127,7 +125,6 @@ public class RemoteRssActivity extends AppCompatActivity {
} }
@TargetApi(Build.VERSION_CODES.HONEYCOMB) @TargetApi(Build.VERSION_CODES.HONEYCOMB)
@OptionsItem(android.R.id.home) @OptionsItem(android.R.id.home)
protected void navigateUp() { protected void navigateUp() {

10
app/src/main/java/org/transdroid/core/gui/remoterss/RemoteRssFilesAdapter.java

@ -12,21 +12,21 @@ import java.util.List;
public class RemoteRssFilesAdapter extends BaseAdapter { public class RemoteRssFilesAdapter extends BaseAdapter {
protected Context context; protected Context context;
protected List<RemoteRssItem> files; protected List<RemoteRssItem> items;
public RemoteRssFilesAdapter(Context context) { public RemoteRssFilesAdapter(Context context) {
this.context = context; this.context = context;
files = new ArrayList<>(); items = new ArrayList<>();
} }
@Override @Override
public int getCount() { public int getCount() {
return files.size(); return items.size();
} }
@Override @Override
public Object getItem(int position) { public Object getItem(int position) {
return files.get(position); return items.get(position);
} }
@Override @Override
@ -51,7 +51,7 @@ public class RemoteRssFilesAdapter extends BaseAdapter {
} }
public void updateFiles(List<RemoteRssItem> torrentFiles) { public void updateFiles(List<RemoteRssItem> torrentFiles) {
files = torrentFiles; items = torrentFiles;
notifyDataSetChanged(); notifyDataSetChanged();
} }
} }

38
app/src/main/java/org/transdroid/core/gui/remoterss/RemoteRssFragment.java

@ -25,6 +25,7 @@ import android.widget.ListView;
import com.nispok.snackbar.Snackbar; import com.nispok.snackbar.Snackbar;
import com.nispok.snackbar.SnackbarManager; import com.nispok.snackbar.SnackbarManager;
import com.nispok.snackbar.enums.SnackbarType;
import org.androidannotations.annotations.AfterViews; import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.Background; import org.androidannotations.annotations.Background;
@ -35,12 +36,14 @@ import org.androidannotations.annotations.ItemClick;
import org.androidannotations.annotations.UiThread; import org.androidannotations.annotations.UiThread;
import org.androidannotations.annotations.ViewById; import org.androidannotations.annotations.ViewById;
import org.transdroid.R; import org.transdroid.R;
import org.transdroid.core.gui.lists.LocalTorrent;
import org.transdroid.core.gui.log.Log; import org.transdroid.core.gui.log.Log;
import org.transdroid.core.gui.remoterss.data.RemoteRssItem; import org.transdroid.core.gui.remoterss.data.RemoteRssItem;
import org.transdroid.daemon.Daemon; import org.transdroid.daemon.Daemon;
import org.transdroid.daemon.IDaemonAdapter; import org.transdroid.daemon.IDaemonAdapter;
import org.transdroid.daemon.task.AddByMagnetUrlTask; import org.transdroid.daemon.task.AddByMagnetUrlTask;
import org.transdroid.daemon.task.AddByUrlTask; import org.transdroid.daemon.task.AddByUrlTask;
import org.transdroid.daemon.task.DaemonTaskFailureResult;
import org.transdroid.daemon.task.DaemonTaskResult; import org.transdroid.daemon.task.DaemonTaskResult;
import org.transdroid.daemon.task.DaemonTaskSuccessResult; import org.transdroid.daemon.task.DaemonTaskSuccessResult;
@ -48,10 +51,9 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
* Fragment that shows detailed statistics about some torrent. These come from some already fetched {@link Torrent} object, but it also retrieves * Fragment that shows a list of RSS items from the server and allows the user
* further detailed statistics. The actual execution of tasks is performed by the activity that contains this fragment, as per the {@link * to download remotely, without having to set up RSS feeds on the Android device.
* TorrentTasksExecutor} interface. * @author Twig
* @author Eric Kok
*/ */
@EFragment(R.layout.fragment_remoterss) @EFragment(R.layout.fragment_remoterss)
public class RemoteRssFragment extends Fragment { public class RemoteRssFragment extends Fragment {
@ -90,8 +92,7 @@ public class RemoteRssFragment extends Fragment {
// } // }
// } // }
// Set up details adapter (itself containing the actual lists to show), which allows multi-select and fast // Set up details adapter
// scrolling
adapter = new RemoteRssFilesAdapter(getActivity()); adapter = new RemoteRssFilesAdapter(getActivity());
torrentsList.setAdapter(adapter); torrentsList.setAdapter(adapter);
torrentsList.setFastScrollEnabled(true); torrentsList.setFastScrollEnabled(true);
@ -104,8 +105,6 @@ public class RemoteRssFragment extends Fragment {
/** /**
* Updates the list adapter to show a new list of torrent files, replacing the old files list. * Updates the list adapter to show a new list of torrent files, replacing the old files list.
* @param checkTorrent The torrent for which the details were retrieved
* @param newTorrentFiles The new, updated list of torrent file objects
*/ */
public void updateTorrentFiles(List<RemoteRssItem> remoteRssFiles) { public void updateTorrentFiles(List<RemoteRssItem> remoteRssFiles) {
torrentFiles = new ArrayList<>(remoteRssFiles); torrentFiles = new ArrayList<>(remoteRssFiles);
@ -113,12 +112,18 @@ public class RemoteRssFragment extends Fragment {
torrentsList.smoothScrollToPosition(0); torrentsList.smoothScrollToPosition(0);
} }
/**
* When the user clicks on an item, prepare to download it.
*/
@ItemClick(resName = "torrents_list") @ItemClick(resName = "torrents_list")
protected void detailsListClicked(int position) { protected void detailsListClicked(int position) {
RemoteRssItem item = (RemoteRssItem) adapter.getItem(position); RemoteRssItem item = (RemoteRssItem) adapter.getItem(position);
downloadRemoteRssItem(item); downloadRemoteRssItem(item);
} }
/**
* Download the item in a background thread and display success/fail accordingly.
*/
@Background @Background
protected void downloadRemoteRssItem(RemoteRssItem item) { protected void downloadRemoteRssItem(RemoteRssItem item) {
RemoteRssActivity activity = (RemoteRssActivity) getActivity(); RemoteRssActivity activity = (RemoteRssActivity) getActivity();
@ -128,7 +133,7 @@ public class RemoteRssFragment extends Fragment {
if (item.isMagnetLink()) { if (item.isMagnetLink()) {
// Check if it's supported // Check if it's supported
if (!Daemon.supportsAddByMagnetUrl(currentConnection.getType())) { if (!Daemon.supportsAddByMagnetUrl(currentConnection.getType())) {
// TODO: onTaskFailed(getString(R.string.error_magnet_links_unsupported));
return; return;
} }
@ -141,8 +146,10 @@ public class RemoteRssFragment extends Fragment {
if (result instanceof DaemonTaskSuccessResult) { if (result instanceof DaemonTaskSuccessResult) {
onTaskSucceeded((DaemonTaskSuccessResult) result, getString(R.string.result_added, item.getTitle())); onTaskSucceeded((DaemonTaskSuccessResult) result, getString(R.string.result_added, item.getTitle()));
} else { } else if (result instanceof DaemonTaskFailureResult){
// onCommunicationError((DaemonTaskFailureResult) result, false); DaemonTaskFailureResult failure = ((DaemonTaskFailureResult) result);
String message = getString(LocalTorrent.getResourceForDaemonException(failure.getException()));
onTaskFailed(message);
} }
} }
@ -150,4 +157,13 @@ public class RemoteRssFragment extends Fragment {
protected void onTaskSucceeded(DaemonTaskSuccessResult result, String successMessage) { protected void onTaskSucceeded(DaemonTaskSuccessResult result, String successMessage) {
SnackbarManager.show(Snackbar.with(getActivity()).text(successMessage)); SnackbarManager.show(Snackbar.with(getActivity()).text(successMessage));
} }
@UiThread
protected void onTaskFailed(String message) {
SnackbarManager.show(Snackbar.with(getActivity())
.text(message)
.colorResource(R.color.red)
.type(SnackbarType.MULTI_LINE)
);
}
} }

6
app/src/main/java/org/transdroid/core/gui/remoterss/RemoteRssItemView.java

@ -24,13 +24,11 @@ import android.widget.TextView;
import org.androidannotations.annotations.EViewGroup; import org.androidannotations.annotations.EViewGroup;
import org.androidannotations.annotations.ViewById; import org.androidannotations.annotations.ViewById;
import org.transdroid.R; import org.transdroid.R;
import org.transdroid.core.app.settings.RssfeedSetting;
import org.transdroid.core.gui.remoterss.data.RemoteRssItem; import org.transdroid.core.gui.remoterss.data.RemoteRssItem;
/** /**
* View that represents some {@link RssfeedSetting} object and displays name as well as loads a favicon for the feed's site and can load how many new * View that represents some {@link RemoteRssItem} object.
* items are available. * @author Twig
* @author Eric Kok
*/ */
@EViewGroup(R.layout.list_item_remoterssitem) @EViewGroup(R.layout.list_item_remoterssitem)
public class RemoteRssItemView extends LinearLayout { public class RemoteRssItemView extends LinearLayout {

6
app/src/main/java/org/transdroid/core/gui/remoterss/data/RemoteRssChannel.java

@ -8,14 +8,14 @@ import java.util.Date;
import java.util.List; import java.util.List;
/** /**
* Created by twig on 1/06/2016. * @author Twig
*/ */
public abstract class RemoteRssChannel implements Parcelable, SimpleListItem { public abstract class RemoteRssChannel implements Parcelable, SimpleListItem {
protected int id; protected int id;
protected String name; protected String name;
protected String link; protected String link;
protected long lastUpdated; protected long lastUpdated;
protected List<RemoteRssItem> files; protected List<RemoteRssItem> items;
@Override @Override
public int describeContents() { public int describeContents() {
@ -35,7 +35,7 @@ public abstract class RemoteRssChannel implements Parcelable, SimpleListItem {
} }
public List<RemoteRssItem> getItems() { public List<RemoteRssItem> getItems() {
return files; return items;
} }
@Override @Override

2
app/src/main/java/org/transdroid/core/gui/remoterss/data/RemoteRssItem.java

@ -7,7 +7,7 @@ import org.transdroid.core.gui.lists.SimpleListItem;
import java.util.Date; import java.util.Date;
/** /**
* Created by twig on 1/06/2016. * @author Twig
*/ */
public abstract class RemoteRssItem implements Parcelable, SimpleListItem { public abstract class RemoteRssItem implements Parcelable, SimpleListItem {
protected String title; protected String title;

10
app/src/main/java/org/transdroid/daemon/Utorrent/UtorrentAdapter.java

@ -117,7 +117,7 @@ public class UtorrentAdapter implements IDaemonAdapter {
private DaemonSettings settings; private DaemonSettings settings;
private DefaultHttpClient httpclient; private DefaultHttpClient httpclient;
private static ArrayList<RemoteRssChannel> rssFeedItems = new ArrayList<>(); private static ArrayList<RemoteRssChannel> remoteRssChannels = new ArrayList<>();
@ -324,19 +324,19 @@ public class UtorrentAdapter implements IDaemonAdapter {
} }
private void parseJsonRemoteRssLists(JSONArray results) { private void parseJsonRemoteRssLists(JSONArray results) {
rssFeedItems = new ArrayList<>(); remoteRssChannels = new ArrayList<>();
RemoteRssChannel item; RemoteRssChannel item;
for (int i = 0; i < results.length(); i++) { for (int i = 0; i < results.length(); i++) {
try { try {
item = new UTorrentRemoteRssChannel(results.getJSONArray(i)); item = new UTorrentRemoteRssChannel(results.getJSONArray(i));
rssFeedItems.add(item); remoteRssChannels.add(item);
} catch (JSONException e) { } catch (JSONException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
Collections.sort(rssFeedItems, new Comparator<RemoteRssChannel>() { Collections.sort(remoteRssChannels, new Comparator<RemoteRssChannel>() {
@Override @Override
public int compare(RemoteRssChannel lhs, RemoteRssChannel rhs) { public int compare(RemoteRssChannel lhs, RemoteRssChannel rhs) {
return lhs.getName().compareToIgnoreCase(rhs.getName()); return lhs.getName().compareToIgnoreCase(rhs.getName());
@ -655,6 +655,6 @@ public class UtorrentAdapter implements IDaemonAdapter {
} }
public ArrayList<RemoteRssChannel> getRemoteRssChannels() { public ArrayList<RemoteRssChannel> getRemoteRssChannels() {
return rssFeedItems; return remoteRssChannels;
} }
} }

92
app/src/main/java/org/transdroid/daemon/Utorrent/data/UTorrentRemoteRssChannel.java

@ -11,87 +11,11 @@ import org.transdroid.core.gui.remoterss.data.RemoteRssItem;
import java.util.ArrayList; import java.util.ArrayList;
/** /**
* Created by twig on 29/05/2016. * uTorrent implementation of RemoteRssChannel.
*
* @author Twig
*/ */
public class UTorrentRemoteRssChannel extends RemoteRssChannel { public class UTorrentRemoteRssChannel extends RemoteRssChannel {
/**
* [
* 1, // id?
* true, // enabled
* false, // false = use custom alias
* false, // ?
* false, // ?
* 0, // ?
* "Castle|http:\/\/showrss.info\/show\/53.rss", // Custom alias|url or url
* 1464520989, // las updated?
* [ // Files
* [
* "Castle 2009 Crossfire", // name?
* "Castle (2009) 8x22 Crossfire", // Title
* // link
* "magnet:?xt=urn:btih:58E032D0B2E595393828FAED47224B3A2C9CCFE6&dn=Castle+2009+S08E22+HDTV+x264+LOL&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",
* 0,
* 0,
* 1463455205, // timestamp
* 8, // season
* 22, // episode
* 0,
* 1,
* false,
* false
* ],
* [
* "Castle 2009 Crossfire",
* "Castle (2009) 8x22 Crossfire 720p",
* "magnet:?xt=urn:btih:6E7764AA9CB23A84914FDB1206A2CD7887CCD622&dn=Castle+2009+S08E22+720p+HDTV+X264+DIMENSION&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",
* 12,
* 0,
* 1463455205,
* 8,
* 22,
* 0,
* 1,
* false,
* false
* ],
* ["Castle 2009 Hell to Pay","Castle (2009) 8x21 Hell to Pay 720p","magnet:?xt=urn:btih:2436547E7A13201C9A3E9409C7D3112C8DF2560C&dn=Castle+2009+S08E21+720p+HDTV+x264+KILLERS&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",12,0,1462762205,8,21,0,1,false,false],
* ["Castle 2009 Hell to Pay","Castle (2009) 8x21 Hell to Pay","magnet:?xt=urn:btih:329A154C7A4FA68F55409C9F0203C0B0F6FB5F43&dn=Castle+2009+S08E21+HDTV+x264+KILLERS&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",0,0,1462762205,8,21,0,1,false,false],
* ["Castle 2009 Much Ado About Murder PROPER","Castle (2009) 8x20 Much Ado About Murder 720p PROPER","magnet:?xt=urn:btih:98A3CF3CC59EB71658964FCB709E572B1401E35E&dn=Castle+2009+S08E20+PROPER+720p+HDTV+x264+KILLERS&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",12,0,1462189505,8,20,0,1,true,false],
* ["Castle 2009 Much Ado About Murder PROPER","Castle (2009) 8x20 Much Ado About Murder PROPER","magnet:?xt=urn:btih:C1E4F55526B298C9BC9F481F781777E1ACD88536&dn=Castle+2009+S08E20+PROPER+HDTV+x264+KILLERS&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",0,0,1462189505,8,20,0,1,true,false],
* ["Castle 2009 Much Ado About Murder","Castle (2009) 8x20 Much Ado About Murder 720p","magnet:?xt=urn:btih:B80E9DA4DF7D88DC9BF62C8677233F6DB4E5E24E&dn=Castle+2009+S08E20+720p+HDTV+x264+FLEET&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",12,0,1462164608,8,20,0,1,false,false],
* ["Castle 2009 Much Ado About Murder","Castle (2009) 8x20 Much Ado About Murder","magnet:?xt=urn:btih:C73F67FDFCDBCF36686F16C79EDDE663669C72CD&dn=Castle+2009+S08E20+HDTV+x264+FLEET&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",0,0,1462164608,8,20,0,1,false,false],
* ["Castle 2009 Dead Again","Castle (2009) 8x19 Dead Again 720p","magnet:?xt=urn:btih:92FF43AF5BE73B8A79119C7C80CCCF3E5091D241&dn=Castle+2009+S08E19+720p+HDTV+x264+KILLERS&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",12,0,1461552608,8,19,0,1,false,false],
* ["Castle 2009 Dead Again","Castle (2009) 8x19 Dead Again","magnet:?xt=urn:btih:EE3DB0A002EF01B655777D8E56AF7C6046B22455&dn=Castle+2009+S08E19+HDTV+x264+KILLERS&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",0,0,1461552608,8,19,0,1,false,false],
* ["Castle 2009 Backstabber","Castle (2009) 8x18 Backstabber","magnet:?xt=urn:btih:C05B22BEE08D82C84B9A96728EE84FDB0E4286F5&dn=Castle+2009+S08E18+HDTV+x264+LOL&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",0,0,1460951407,8,18,0,1,false,false],
* ["Castle 2009 Backstabber","Castle (2009) 8x18 Backstabber 720p","magnet:?xt=urn:btih:27FB8EC5F537267F8A5543D728150E278B8E4D35&dn=Castle+2009+S08E18+720p+HDTV+x264+2HD&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",12,0,1460949608,8,18,0,1,false,false],
* ["Castle 2009 Death Wish","Castle (2009) 8x17 Death Wish","magnet:?xt=urn:btih:A772093AB91C9A87B1289DBFE7010B088A3FDCD4&dn=Castle+2009+S08E17+HDTV+x264+KILLERS&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",0,0,1460438409,8,17,0,1,false,false],
* ["Castle 2009 Death Wish","Castle (2009) 8x17 Death Wish 720p","magnet:?xt=urn:btih:ECAE7F4DCCB015F3052907CB9EBF255B718B74B4&dn=Castle+2009+S08E17+720p+HDTV+x264+AVS&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",12,0,1460433007,8,17,0,1,false,false],
* ["Castle 2009 Heartbreaker","Castle (2009) 8x16 Heartbreaker","magnet:?xt=urn:btih:1523E75580E6D4EDB34EAE287D53018C365A25BD&dn=Castle+S08E16+WEB+DL+x264+RARBG&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",0,0,1459863906,8,16,0,1,false,false],
* ["Castle 2009 Heartbreaker","Castle (2009) 8x16 Heartbreaker 720p","magnet:?xt=urn:btih:780628ABAADA1F7EEA98F4ED3FE971FCB2550D4E&dn=Castle+2009+S08E16+720p+HDTV+x264+SVA&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",12,0,1459828206,8,16,0,1,false,false],
* ["Castle 2009 Fidelis Ad Mortem","Castle (2009) 8x15 Fidelis Ad Mortem","magnet:?xt=urn:btih:ECB8DF64844076F4EB18349569FEA48DE4B4F2F9&dn=Castle+2009+S08E15+WEB+DL+x264+FUM&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",0,0,1458640207,8,15,0,1,false,false],
* ["Castle 2009 Fidelis Ad Mortem","Castle (2009) 8x15 Fidelis Ad Mortem 720p","magnet:?xt=urn:btih:829C270329F1527D5C1DF7AEE8D6E31028CB23A8&dn=Castle+2009+S08E15+720p+HDTV+x264+AVS&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",12,0,1458618610,8,15,0,1,false,false],
* ["Castle 2009 The G.D.S","Castle (2009) 8x14 The G.D.S.","magnet:?xt=urn:btih:4110431702205393AF8278E9018E4F2D9B3CB28E&dn=Castle+S08E14+WEB+DL+x264+RARBG&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",0,0,1457459708,8,14,0,1,false,false],
* ["Castle 2009 The G.D.S","Castle (2009) 8x14 The G.D.S. 720p","magnet:?xt=urn:btih:B69272F3FC841B6BA37EAE3D2E7128B2ED846F50&dn=Castle+2009+S08E14+720p+HDTV+x264+AVS&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",12,0,1457412606,8,14,0,1,false,false],
* ["Castle 2009 And Justice For All","Castle (2009) 8x13 And Justice For All 720p","magnet:?xt=urn:btih:9715C7CE755DFE6D23633D5E8BA08A7FE2DE7347&dn=Castle+2009+S08E13+720p+HDTV+x264+KILLERS&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",12,0,1456807809,8,13,0,1,false,false],
* ["Castle 2009 And Justice For All","Castle (2009) 8x13 And Justice For All","magnet:?xt=urn:btih:0638AC833ED9D2D72C880FF385651A6BA6CE28EE&dn=Castle+2009+S08E13+HDTV+x264+KILLERS&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",0,0,1456807809,8,13,0,1,false,false],
* ["Castle 2009 The Blame Game","Castle (2009) 8x12 The Blame Game 720p","magnet:?xt=urn:btih:E49F11DC34E7ADC87BBF798C6BB45D49C8475466&dn=Castle+2009+S08E12+720p+HDTV+X264+DIMENSION&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",12,0,1456195816,8,12,0,1,false,false],
* ["Castle 2009 The Blame Game","Castle (2009) 8x12 The Blame Game","magnet:?xt=urn:btih:A9417E1BDD7887C6DB18D06DB37DC48567766D04&dn=Castle+2009+S08E12+HDTV+x264+LOL&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",0,0,1456194022,8,12,0,1,false,false],
* ["Castle 2009 Dead Red","Castle (2009) 8x11 Dead Red 720p","magnet:?xt=urn:btih:94DD4AC8826A59814887E780D38F6D0FCD8590E3&dn=Castle+2009+S08E11+720p+HDTV+X264+DIMENSION&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",12,0,1455591012,8,11,0,1,false,false],
* ["Castle 2009 Dead Red","Castle (2009) 8x11 Dead Red","magnet:?xt=urn:btih:E44F825E3D3B6BE3471A833185B04DCA74A3674D&dn=Castle+2009+S08E11+HDTV+x264+LOL&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",0,0,1455589221,8,11,0,1,false,false],
* ["Castle 2009 Witness for the Prosecution","Castle (2009) 8x10 Witness for the Prosecution 720p","magnet:?xt=urn:btih:6E0F4DA3529B63BE75AECDC9EA1248305A8AD9D7&dn=Castle+2009+S08E10+720p+HDTV+X264+DIMENSION&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",12,0,1455515410,8,10,0,1,false,false],
* ["Castle 2009 Witness for the Prosecution","Castle (2009) 8x10 Witness for the Prosecution","magnet:?xt=urn:btih:8DD8E60B78C1A6703727FD54055C1DA4AD422222&dn=Castle+2009+S08E10+HDTV+x264+LOL&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",0,0,1455513610,8,10,0,1,false,false],
* ["Castle 2009","Castle (2009) 8x09","magnet:?xt=urn:btih:2F5BDC5958C2B7BCBC568D76F1487E68A95B74D3&dn=Castle+2009+S08E09+HDTV+x264+LOL&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",0,0,1454991609,8,9,0,1,false,false],
* ["Castle 2009","Castle (2009) 8x09 720p","magnet:?xt=urn:btih:E21DF496B8F838C37C2F191A623D6EA3315190BD&dn=Castle+2009+S08E09+720p+HDTV+X264+DIMENSION&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",12,0,1454991609,8,9,0,1,false,false],
* ["Castle 2009","Castle (2009) 8x08 720p","magnet:?xt=urn:btih:96A21B41A80043280AA2241C4530AF529655EB8D&dn=Castle+2009+S08E08+720p+HDTV+X264+DIMENSION&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",12,0,1448337002,8,8,0,1,false,false],
* ["Castle 2009","Castle (2009) 8x08","magnet:?xt=urn:btih:4E7BBE21D8B18DC09A9647038DC3254D7E85864C&dn=Castle+2009+S08E08+HDTV+x264+LOL&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",0,0,1448334902,8,8,0,1,false,false],
* ["Castle 2009","Castle (2009) 8x07","magnet:?xt=urn:btih:428208294D380ABDAA2CA9CD4DC0B1CC6CBD2CC8&dn=Castle+2009+S08E07+HDTV+x264+LOL&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",0,0,1447728601,8,7,0,1,false,false],
* ["Castle 2009","Castle (2009) 8x07 720p","magnet:?xt=urn:btih:3CDBF2ED5C14F1E514772D6541EC9D087F0AE3F3&dn=Castle+2009+S08E07+720p+HDTV+X264+DIMENSION&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",12,0,1447728601,8,7,0,1,false,false],
* ["Castle 2009","Castle (2009) 8x06 720p","magnet:?xt=urn:btih:BD99B76B9B3E9BC2401CBAB9100CB1A8CB0F9813&dn=Castle+2009+S08E06+720p+HDTV+X264+DIMENSION&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",12,0,1447131002,8,6,0,1,false,false]
* ]
* ]
*/
public UTorrentRemoteRssChannel(JSONArray json) throws JSONException { public UTorrentRemoteRssChannel(JSONArray json) throws JSONException {
// boolean enabled = json.getBoolean(1); // boolean enabled = json.getBoolean(1);
boolean isCustomAlias = !json.getBoolean(2); boolean isCustomAlias = !json.getBoolean(2);
@ -108,7 +32,7 @@ public class UTorrentRemoteRssChannel extends RemoteRssChannel {
name = link; name = link;
} }
files = new ArrayList<>(); items = new ArrayList<>();
JSONArray filesJson = json.getJSONArray(8); JSONArray filesJson = json.getJSONArray(8);
RemoteRssItem file; RemoteRssItem file;
@ -116,7 +40,7 @@ public class UTorrentRemoteRssChannel extends RemoteRssChannel {
for (int i = 0; i < filesJson.length(); i++) { for (int i = 0; i < filesJson.length(); i++) {
file = new UTorrentRemoteRssItem(filesJson.getJSONArray(i)); file = new UTorrentRemoteRssItem(filesJson.getJSONArray(i));
file.setSourceName(name); file.setSourceName(name);
files.add(file); items.add(file);
} }
} }
@ -126,8 +50,8 @@ public class UTorrentRemoteRssChannel extends RemoteRssChannel {
link = in.readString(); link = in.readString();
lastUpdated = in.readLong(); lastUpdated = in.readLong();
files = new ArrayList<>(); items = new ArrayList<>();
in.readList(files, UTorrentRemoteRssItem.class.getClassLoader()); in.readList(items, UTorrentRemoteRssItem.class.getClassLoader());
} }
@Override @Override
@ -136,7 +60,7 @@ public class UTorrentRemoteRssChannel extends RemoteRssChannel {
dest.writeString(name); dest.writeString(name);
dest.writeString(link); dest.writeString(link);
dest.writeLong(lastUpdated); dest.writeLong(lastUpdated);
dest.writeList(files); dest.writeList(items);
} }
public static final Parcelable.Creator<UTorrentRemoteRssChannel> CREATOR = new Parcelable.Creator<UTorrentRemoteRssChannel>() { public static final Parcelable.Creator<UTorrentRemoteRssChannel> CREATOR = new Parcelable.Creator<UTorrentRemoteRssChannel>() {

5
app/src/main/java/org/transdroid/daemon/Utorrent/data/UTorrentRemoteRssItem.java

@ -10,6 +10,11 @@ import org.transdroid.core.gui.remoterss.data.RemoteRssItem;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
/**
* uTorrent implementation of RemoteRssItem.
*
* @author Twig
*/
public class UTorrentRemoteRssItem extends RemoteRssItem { public class UTorrentRemoteRssItem extends RemoteRssItem {
// public String name; // public String name;
// public int season; // public int season;

2
app/src/main/res/layout/activity_remoterss.xml

@ -15,7 +15,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with Transdroid. If not, see <http://www.gnu.org/licenses/>. along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
--> -->
<!-- This layout is for phones in portrait and shows the torrents list with the filters as navigation drawer. --> <!-- This layout is for phones in portrait and shows the remote RSS items list with the filters as navigation drawer. -->
<android.support.v4.widget.DrawerLayout <android.support.v4.widget.DrawerLayout
android:id="@+id/drawer_layout" android:id="@+id/drawer_layout"
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"

1
app/src/main/res/menu/activity_torrents_main.xml

@ -41,4 +41,5 @@
android:id="@+id/action_settings" android:id="@+id/action_settings"
android:title="@string/action_settings" android:title="@string/action_settings"
app:showAsAction="always" /> app:showAsAction="always" />
</menu> </menu>

3
app/src/main/res/values/strings.xml

@ -25,7 +25,7 @@
<string name="action_search">Search</string> <string name="action_search">Search</string>
<string name="action_refresh">Refresh</string> <string name="action_refresh">Refresh</string>
<string name="action_rss">RSS</string> <string name="action_rss">RSS</string>
<string name="action_remoterss">Server RSS</string> <string name="action_remoterss">Remote RSS</string>
<string name="action_enableturtle">Enable turtle mode</string> <string name="action_enableturtle">Enable turtle mode</string>
<string name="action_disableturtle">Disable turtle mode</string> <string name="action_disableturtle">Disable turtle mode</string>
<string name="action_sort">Sort list</string> <string name="action_sort">Sort list</string>
@ -443,6 +443,7 @@
<string name="error_httperror">Error during communication; check your connection</string> <string name="error_httperror">Error during communication; check your connection</string>
<string name="error_unsupported">Your torrent client does not support this operation</string> <string name="error_unsupported">Your torrent client does not support this operation</string>
<string name="error_magnet_links_unsupported">Your torrent client does not support magnet links</string>
<string name="error_jsonrequesterror">Internal error building request</string> <string name="error_jsonrequesterror">Internal error building request</string>
<string name="error_jsonresponseerror">Error parsing server response (please check your settings)</string> <string name="error_jsonresponseerror">Error parsing server response (please check your settings)</string>
<string name="error_daemonnotconnected">Web interface not connected to a running daemon</string> <string name="error_daemonnotconnected">Web interface not connected to a running daemon</string>

Loading…
Cancel
Save