8/30/14

Manga On-The-Go

So with the wonders of having tons of android applications in the palm of my hand, it's a good time to search for more anime/manga related things that can enhance our overall nonproductive past-time. This spans more than just simple things like wallpapers or ringtones, but actual apps that might count as objectively useful. First on the mental list is one that I have been searching for for a very long time is a manga reader. I'm not going to lie, this is going to be one hell of a fucking long post with multiple walls of text. Be prepared. Hug your dakimakura if you have to.

Reading manga from online is a fairly funny experience thanks to the nature of it and thus the list of manga readers is constantly fluctuating. Luckily some don't die, even after being pulled from the Play Store, and so this comparative list will encompass some of those as well. Now there are a lot of shitty manga readers and this list will completely ignore most of those. The ones that I will look at are:
- Manga Galaxy
- Manga Infinite
- Manga+/MangaBlitz
- Manga Rock
- Manga Searcher
- MangaWatcher
- Mango
- Ultimate Manga

So we have a list of applications, now we need some criteria to go on. My criteria is rather shoddy, but as long as it accomplishes them, they are good in my book.
- Nice, easy to maneuver interface
- Basic features (notification of new chapters, backup/restore, filtering/search, offline library)
- Aesthetically pleasing
- Most of the manga sources

Manga Galaxy:
This app was recently pulled from the Play Store around July currently there is a link to the latest free version on the Manga Galaxy facebook page. Honestly, I find this app to be really well done. It has a dark theme and everything from the list of manga to the settings are clear and easy to understand. It has filtering, searching, offline library, bookmarks, download queue, backup&restore, notification of new chapters, and recent updates. Lazy loading along with rather aggressive cache management make shuffling through the manga list smooth and yet not smooth at the same time. Put simply, everything slides up and down like butter, but until you lift your finger from the screen, no images are loaded and pretty much any of the images that fall offscreen are instantly removed.

Then there is the lazy loading, which in theory is supposed to be loading things only as needed and thus the experience should be rather smooth and equal throughout, but a slightly different approach was used in which a chunk is loaded up first (so maybe like the first 20 manga of the list) and then nothing else is loaded until you reach the bottom of that list, then a window pops up and tells you it's loading more of the list. Deviantart uses a similar method, but you can literally scroll down forever and not notice the lag time between loading unless you hold down the page down key. It's a shitty comparison, but maybe you get the idea. Honestly, I wouldn't mind waiting longer to cache the whole search and forgo the waiting inbetween "chunks" because it's just smoother that way. Of course, I say this without a paying a lick towards any sort of resource/memory management or maybe constraints that the Android SDK might have (so who knows, maybe you can't do much while someone is moving around the UI).

More about the app itself, the manga list shows just the covers of each manga and the extra information (synopsis, etc.) are shown after selecting a manga, which I don't mind. There IS however, a lot of "wasted space" in my opinion. On my Nexus 5, I am only shown 4 series at a time complete with the whole series picture and title. It's not a killing blow or anything, but I wouldn't mind seeing more of the screen being put to use. Another gripe is the lack of list view, which is apparently possible, as the "latest" listing type utilizes it, but not available for the offline library, favorites, or history pages.

Enough of the bad though, there are also a number of really neat things that I like about this app as well. You can select the default first page, toggle a global search through all sources, and it has a rather nice advanced image viewer that does lazy loading beautifully (on local stuff). All in all, even though there are some very minor ticks that I happened to point out in length, the app itself is a pretty solid pick that I honestly find really appealing both in features and presentation. I'd give it a 8 out of 10.

Manga Infinite:
If I had to sum up my first impressions of this reader, it pretty much sums up to "shit's ugly". It's like the prototype UI to a reader that could be, but isn't. There aren't really any settings to speak of and the download queue screen looks atrocious because it's like halfling between slide out side bar and an actual tab. This app just looks really bad in comparison to something like Manga Galaxy, and doesn't even have as many features. It does have online sync...I think...and the ability to clean the cache with the press of a button. I'm just calling it here and giving it a 5/10. It's ugly, clunky to use, but does have most of the basics features working.

Manga+/MangaBlitz:
Apparently this one had an identity crisis when it was pulled from the Play Store. Long story short, it's interface is nothing short of a sexy sort of simple, and it is damn simple. You are greeted with your local library when you boot, which you can toggle to show your unread, favorite, or all of your local manga. Sliding out the left sidebar, you can get to a search, download queue, and updates for the manga you have in your library. You have next to no settings, and by that I mean you only get three checkboxes to worry about. There were no fucks given for looking overcrowded or not and so it shows series covers slapped right next to each other and a simple tinted overlay with the title on top giving me a glorious 9 different series per screen. Lazy loading once again for the covers, which isn't bad. I don't like how the logo is plastered as default though (something plain or nothing at all would have been better in my opinion) because it draws my eyes away from the stuff I actually want to see...the covers ._.

The search screen is particularly beautiful though. Literally a toggle in the corner for what source to use, a small space for if you want to search for a manga title, and the rest of the screen is dedicated towards genre toggles. The problem is that the search function is kinda shitty. Using the "All Sources" search will give all the results for all of the sources...without combining the same manga series into one tile, thus you can find the same series from a different site...at least I think it's a different site. Using specific websites apparently causes the search results to only show 20 rows before it just stops, but the search is persistent. There is also no "download all" button that magically queues up the entire series, so you have to tap every single chapter to add them to the queue. At the very bottom of the list of available chapters is the "Notify updates" button which has it's positives and negatives. It allows for selecting specific series for notifications...but it's off by default on everything, even if it's in your library. So you would have to toggle it on for all of your manga if you want it, unless you want just a couple of really main ones (like if Mahou Shoujo of the End released a new chapter) which you just HAVE to know about as soon as it is up. Otherwise, there still is that sidebar.

There also seems to be some bugginess in the app. After selecting a manga series from the library, it shows the chapters available locally and an info button on the upper right corner...sometimes this button works as it should and show the info page with the ability to tap chapters to download more...and other times it doesn't do anything.

Unsurprisingly, this app also suffers from not having a list view, but thanks to it cramming as much shit into a screen as possible, I honestly don't even mind because it still allows for some rather rapid scrolling. It also doesn't have quite as many sources as some of the other apps, but it does have a number of the major English ones. All in all, the minimalism is really nice and there are just a small few quirks that might need to be refined. Maybe even some nice settings for the otherwise spartan image viewer. I'd give it an 7/10.

Manga Rock:
So we come to the "premier" manga reader, at least in terms of being the first search result on the list when searching for a manga reader. It's been around for a while and seems to have been able to come back to the Play Store at least once or twice. There are a number of things done right in this app, surprisingly enough. They have a wonderful series picture view that can just about fit 9 series per screen and even have a list view. There is a search button that seems to work, the filters screen is for the most part a nice looking screen, though taking a leaf out of MangaBlitz's book would be nicer in my opinion. The lazy loading is spectacularly done, making the manga list just feel spiffy and responsive. It's also nice that they used a normal loading animation rather than their logo. Viewing information on a manga gives a convenient download button where you can toggle different chapters you want to download, or a spectacular "select all" button. The sidebar gives access to the entire list of manga from a selected source, the latest updates to any series from said source, a favorites list, an offline library, recently read manga, discovering new manga, a backup/restore, download queue, notifications, and settings.

Bringing back things to gripe about, the settings page is more dedicated towards info about the app than your settings apparently. The actual settings are condensed into the manga sources to use, language of the interface, and then "Personalize" which just has everything else that could be considered a setting. Another issue I have is actually with the color used in the manga list, which is white, in comparison to pretty much EVERYTHING ELSE, which is a dark grey to black. Another peeve is calling the offline library "Downloaded" instead of "Library" or something. Sure it's still technically a totally fine listing title, but pretty much all the other ones use library, which I feel is a better choice of words.

The most glaring flaw to the cheap manga lover such as myself is that there is a "Full Version" of this application. Sure, it's fine having ads maybe persistent at the bottom or inbetween chapters since you can't fuel prolonged development off of good will alone, but Manga Rock is the only one so far that has a free version where you are restricted to only having a single series downloaded locally. It's an annoyance in an otherwise rather nice manga reader. Hell I even like the image viewer which is on par with Manga Galaxy's viewer...only Manga Rock's looks nicer thanks to some really clean icons. As much as I hate that it's a paid application, it still gets a 9/10 because a large number of things right.

Manga Searcher:
This one is similar to MangaBlitz in that it is a simple interface. Not sexy at all, but it's simple. You get four tabs, no settings to speak of, a simple image viewer, rather odd choice of icons that kind of make sense...but don't, and a lot of disgustingly wasted screen space. The four tabs are "Top 100", "Surprise", "Favorite", and "Loading". Most of them are easy to understand except maybe Loading...which is your download queue. At the very bottom of the screen, you get a search button without anything. It's literally just a search where you enter a query and search for it. There is no filtering, no genre specifications, no anything, just a simple search. You don't even get told where the manga is coming from, it's just magically there and the stuff you search may also magically be there. This should really be a 3 or 4 out of 10 because comparing with MangaBlitz, this one doesn't even have basic features.

MangaWatcher:
Now we finally reach my original manga reader of choice since way back when. The UI has had a major revamp since then, and thankfully for the better though you still have the option to revert to the older UI. In both views, there are 9 series that can be fully seen and 3 series partially seen per screen, giving access to a total of 12 series per screen with the cover size set to "small". It's not quite as hardcore as MangaBlitz with it's spacing, so there is some unused border space around each cover, but it's not overbearingly wide like with Manga Galaxy. It has a sync feature along with a cloud library apparently dealt with over the developer's own server, along with a local backup/restore. There are also categories available for customization and a kind of neat, but completely useless profile page with stats of how much manga you read over some duration, achievements, genre preferences, etc.

The searching works a little different in MangaWatcher than it does in the other manga readers as first you choose a manga source, which it will then take some time to load the entire list displayed in a listing where you can search for a specific manga, or use genre filters and sort by ratings or alphabet. After that, you add the manga to your library, move on to the next one, and just continue down the list. It makes mass adding series of a certain genre or genres just a little bit convenient (Manga Rock also can do this).

One nifty, but almost irrelevant feature is the ability to modify specific series to change the title, reading direction, storage folder, and viewer settings on a per manga series basis. I never use it, but it's there. The rest of the interface is rather simple to use, though I would really prefer a dark theme to match the rest of my phone rather than the off-white and blue theme that matches nothing. If anything, at least it's consistent with it's theme. The only major gripes I have with MangaWatcher is the nonsensical cloud sync library which I have yet to figure out how to correctly use, and the shoddiness of the app. There is literally a button to Check and Fix stuff because once upon a time, EVERYTHING in the manga list would get duplicated and ruin stuff. Now things seem to run fairly well with maybe the occasional crashing that happens infrequently. Thanks to the shoddiness, I'd give it maybe a 7 or an 8. It does what it's supposed to do, but it's not the prettiest of the bunch at doing it.

Mango:
Now we are at Mango, the "dead since ages ago" manga reader that is still online, but gets no updates or anything. The project itself looks dead, so if you encounter any bugs or anything, you are on your own. With that said, it looks simplistic and kind of ugly, but it still keeps a number of settings and has pretty much all of the basic features. The sources list is somewhat lacking in comparison to some of the other manga readers, but it's also got most of the major English ones. The search is kind of similar to MangaWatcher in that you select your source first, but it does add a slight bit of finesse between that and the results and gives some other options to browse the manga list, such as by popularity, or the latest updates, or the artist, as well as genres, though when I say genres, I mean a single genre at a time.

There are no sidebars here at all, and there are really only 4 options that consist of: "Browse Manga", "My Library", "Favorites", and "History". Thankfully all of them are well named and I don't really need to explain that. It has persistent ads to support development...of which there is no development, so these ads are more just there to get some money. Of course you could pay to remove the ads...but if you are going to pay, you might as well go for Manga Rock. Flicking through pages in the clunky image viewer is workable, but not a very grand experience. All in all, this one is a pretty simple one. It might crash sometimes, it looks kind of ugly, it does have the basics, but there are better implementations now so this deserves a 6/10 in my book. It does still work and look better than Manga Infinite.

Ultimate Manga:
This is another rather minimalistic application that is even more spartan than MangaBlitz in more ways than one. There is a severely limited catalog of sources, only list view for manga, no filters or genre searching, no settings, a mega simplistic viewer, and a white theme. On the plus side, it has a download queue, a local library, and a download all button.

Though functionally on the lesser end, the layout and overall performance is actually rather nice...but the major issue is that the main function seems to be broken and manga can't be viewed or downloaded from two of the sources. The remaining two sources consists of one that is not in English and therefore useless to me, and the other I've never heard of BUT at least one is working. Unfortunately, the developer seems to have gone MIA since there hasn't been an update since April. As it is, I can only give it a 4/10. It's minimalism is nice, but you have to go far down the rabbit hole to enjoy it.

Thus we come to the end of the list and as a small bit of extra information on MangaBlitz, the info button bug is apparently known to the developer and fixed in the next (currently not released) version. Supposedly, eventually the 20 rows of manga series will also get lazy loading, along with the viewer getting some inertial scrolling, though how long that will take is up in the air. As the final pick, I'm somewhat surprised to say that my ranking has given Manga Rock as the top manga reader currently available for android. It just doesn't seem to have as many glaring flaws despite me liking some other UIs more, but it does have that single manga series offline at a time for the free version.

8/17/14

Android and LibMTP

So obviously being a cool guy, you have an android device or two that you may or may not want to connect via usb to your computer. While in windows, mtp is either barely passable or you just can't get the shit to work at all. In both cases, mtp is annoying to use and all around terrible in comparison to the old way of just mounting directly in my opinion. Fortunately, the Archlinux wiki has an article on that (as with almost everything else ._.) and all that really needs to be installed are gvfs and libmtp, though apparently gvfs-mtp is still available as a separate package. It has already been merged upstream and released with gvfs 1.15.2, so any version after, you probably don't need gvfs-mtp.

As a quick note, installing just gvfs and libmtp on a vanilla Arch install as of right now won't give you a working auto-magically mounting android MTP device. This is because gvfs apparently also needs a polkit authentication agent like pkttyagent, lxpolkit, mate-polkit, polkit-gnome, or polkit-kde...and that needs the session to be started with dbus-launch. Pkttyagent is included by default as a console auth agent, though I use lxpolkit anyway since having a GUI agent allows me to open things like GParted with pkexec.

Usually this is enough to get things working, but sometimes the device might have not been added yet to their massive list of udev rules. Of course instructions are on the wiki so you can just add those, reload udev rules, and maybe reboot.

Now this still has the same problems that mtp does on Windows, primarily that what is shown on the computer and the phone do not always show the same things after manipulating files with the phone because that is how MTP supposedly works. Anyway, with that MTP should supposedly be working and all sorts of magic happening with any file manager that supports gvfs (PcManFM, Thunar, etc.).

Raspberry Pi from Five

So we are finally at the end of the great raspberry pi journey for media serving and the last thing we really need is a way to protect our precious collection. This can be encompassed into two main ideas: protecting what goes in and out of your computer via the network, and protecting the stuff on your filesystem. Most of this I can't go in-depth about, but the general idea is to have a firewall for filtering what stuff comes in, encrypt and proxy around stuff that goes out, and encrypt the files in your filesystem. I have next to no opinions for any of these since I do none of them :D. But I'll still list stuff off the top of my head that pertain to it.

Firewall:
- IPTables: Pretty much the baseline for firewalls on Linux, most of everything else is a frontend.
- Any of the IPTables front-ends (Gufw is apparently one of the popular ones)

Encrypting Traffic out:
- Https for everything (both firefox and chromium have plugins for HTTPS everywhere)
- SSL/TLS for everything (this and HTTPS are more about protecting your web browsing)
- DNSCrypt: Helps prevent spying and man-in-the-middle attacks because apparently your IP can still be leaked to the ISP even with https/vpn/ssl, and guess what, it just wraps your DNS conversation stuff in SSL as well :D.
- A VPN service...which costs money...Pretty much, they will encrypt all of your data that you send out and bring in. Apparently PrivateInternetAccess is one of the better ones that also allows torrent traffic.
- A seed box: It downloads for you and then you can get the files over ftp or something...aka connect your raspberry pi to a network that isn't yours and use ngrok to be able to connect to it...but you better be damn confident that it's not going to go down easy.

Encrypting File System:
- Once upon a time it was TrueCrypt...maybe there will be a derivative somewhere later on.
- Tomb: Not only is it witty, but it's quite good...as long as you don't lose your key and password...which you still need to hide somewhere.

Some extra tidbits: You may have noticed that for a "hide your shit" post, there isn't any mention of the tor project and there is a simple reason for this. You should never use bittorrent over tor....ever....because it wasn't made for bittorrent traffic, it just won't work and if you do it, your results WILL be subpar. Also, sending your traffic through these things will show a performance hit in torrenting speed, but at least you can't get rekt until they have a probable cause that you have amassed a huge amount of something and find your tomb on your confiscated computer and forcefully find a way to get the key out from your cold, dead hands. Unfortunately, this means that you need to manually handle your tomb file and optionally make a script to clean up your dirty work so only you know where it is.

Raspberry Pi from Four

So we are finally complete with all of our wondrous automation on our raspberry pi and thus, now is the time for a recap of what remaining stuff we need to deal with.


  • A protocol to serve our media to another device on the network
  • Maybe something to hide ourselves so we aren't blatantly telling the world that anime is all we ever want

  • Today is a day where we will talk about another subject that I know next to nothing about, but that is totally fine because the internet never lies. Only truths here... Anyways, we are just taking a quick poke at a couple of major types of file transfer protocols so we can stream stuff...maybe...Mostly, it's a preference thing and word from other people about the general performance differences between the different protocols, so I can't hate you for any choice you decide to go with. Of course with that said, it's probably best to get the lightest and fastest because the raspberry pi has a single controller for the ethernet and usb ports, thus it's already shoveling stuff through a pipe as it is. 

    • FTP: It's better than SMB at least. Worst case, it's always worth it to give ftp a shot if all else fails.
    • FTPS: The more preferred way of ftp usage because we need to be secure about our anime. 
    • SMB: Normally a pick if you have a windows computer, but you don't because I say so. Also, it's not the fastest out there, therefore SMB isn't needed.
    • SSHFS: This should really only be compared to NFS, and unfortunately NFS wins in the speed department.
    • SFTP: Kind of follows suit with SSHFS, though it's not really surprising since it is also on top of SSH.
    • SSH: A really clunky way to go about streaming (ssh user@ip "cat path/to/video" | mpv), but it's available if shit really hits the fan or you just don't want to use anything else.
    • UPnP/DLNA: Literally only for streaming media and nothing else. No file manipulation or anything, so you would have to ssh into the pi to manage stuff. Not particularly bad, but being able to manage would be nice.
    • RSync: Not really streaming so much as just copying it to your client computer, but I guess if you sent it to /tmp/ or something it could be considered streaming.
    • NFS: Probably the best choice out of the group in terms of flexibility and performance, and the overhead isn't all that bad either.
    Now, I haven't done any testing on the performance of ANY of these really. At best, I have tried nfs, ftp, and UPnP/DLNA, and in the end I preferred the nfs route. Thus, we are going to set up an nfs server.

    First things first is to grab the nfs-utils package for both the server and client and make a new folder to hold all of our stuff that we are going to serve out. A simple "sudo mkdir -p /srv/nfs4/foldername" would do just fine unless you plan to split up your stuff and mount each to separate folders (ex. Music, Anime, Manga, etc.). Then we need to bind the mount point of our hard drive to the serving folder, this can be done manually with "sudo mount --bind /harddrive/path /srv/nfs4/foldername" or by adding another entry to the fstab to mount for you at boot that follows the lines of "/harddrive/path /srv/nfs4/foldername none bind 0 0". Then we need to set up what to export aka serve.

    Opening the /etc/exports file, we want to write down what we want to serve, who we want to serve, etc. This should be pretty easy to do (even has examples) so something along the lines of "/srv/nfs4/foldername  192.168.1.0/24(rw,async,no_subtree_check,nohide)" will work just fine. Supposedly async and no_subtree_check will make the transfers just a tad faster, which is always nice. After that, "exportfs -rav" should update the exports and you should be ready to start the services with systemd. I would suggest enabling the services and then rebooting rather than just starting, but either is fine. Just "sudo systemctl enable nfs-server" should start up everything needed on the server.

    On our client linux box, we need to set up our nfs client which can be done by enabling rpcbind.service and nfs-client.target. To check our setup, you can use "showmount -e" or "showmount -e raspberrypiIP" depending on if you are on the server or client respectively and to mount the nfs share client-side is a simple "sudo mount rPiIP:/srv/nfs4/sda1 /path/to/mount/point".

    Supposing everything is working, we can optionally continue on and discuss about mounting automatically using fstab, systemd, autofs, etc. In my opinion, the "Tip and Tricks" section of the NFS page in the Arch wiki has a rather nice "Automatic mount handling" section that would probably work well in the event that our raspberry pi goes down for some reason (which might happen).

    Once mounted, you should be able to read/write to it per usual and magical greatness should ensue. Some things to note:
    - You can tune the performance by modifying the rsize and wsize options of the client-side mount.
    - Streaming from NFS works well with animated shorts, but the same can't be unanimously said for large files. It may take a short amount of time to cache some of the video before you can have a smooth playing experience. Of course, this can be somewhat mitigated by tuning the performance.

    7/20/14

    Raspberry Pi from Three and Three Fourths

    Finally we are at the end of setting up our magical torrenting client and all we need to do is have a way to add our anime to an rss watch list. Luckily enough, we have just the plugin that can deal with RSS feeds, but to keep things in order, first we need to decide on a feed to follow.

    The normal sites that I assume are standard when it comes to searching for this kind of media: Nyaa.se, Tokyo Toshokan, BakaBT, and ShanaProject. Out of these, ShanaProject is probably the most anime-oriented and is kind of specifically a site just for tracking anime and has user specific feeds that you can use to follow and track different fansub groups for different anime. It's the default feed of choice for me, but there are perks to using the others as well. Something to note though, Shanaproject along with Tokyo Toshokan pretty much aggregate torrents from Nyaa (at least in terms of anime), so there isn't much point to using all three of them.

    To give a quick run-down of the options aside from ShanaProject:

    • BakaBT: A "community" that dislikes leechers and doesn't seem to have any RSS feeds, making automation a bit of a bitch.
    • Nyaa: The defacto tracker for pretty much all of the fansub groups. If they aren't on Nyaa, they are just retarded somehow.
    • Tokyo Toshokan: The best option for all types of media from Japan. It aggregates anime, manga, music, etc. and has a customizable RSS to boot. Also, it has some re-encoders (hi10ani.me) if they actually put up torrents.
    Anyways, after picking a feed to follow, we just click on the nice little rss icon in rutorrent, add our first rss feed and give it a name. Clicking on the rss icon afterwards now will bring up the RSS manager where all things great and automated occur. It's pretty simple from there, just come up with a name for your new subscription (usually I just title it the name of the anime), a regexp pattern to look for (ex. "/Akame ga Kill.*\[FFF"), the feed to watch, and a subfolder to download it into if you want (it defaults to the downloads directory of rtorrent). After that, the ratio rule and group from the previous post will deal with removal.

    At this point, if you added the anime for each running season, your setup would automatically download, seed, and remove your torrents for the entire season without you needing to do a thing. It is probably possible to add an extra script to automatically generate even the configurations for the rss, but I currently don't have a script for that (in due time, I will get that since there happens to be a rather nifty link available on MAL).

    To take rutorrent a little bit farther and make it actually decent as a torrent client for things like older anime series or episodes that are not on the latest feeds of Nyaa or Tokyo Toshokan, I made some extra search engines for the extsearch plugin (thanks to the wonderful and fairly simple examples of the other engines). Just save them into /srv/http/rutorrent/plugin/extsearch/engines/<searchengine>.php files and they should magically appear and be ready for use.

    Nyaa: http://pastebin.com/D5S6NCyi
    SukebeiNyaa: http://pastebin.com/fLgXAAxu
    TokyoTosho: http://pastebin.com/mS67ZqnX

    Anyways, with that we FINALLY have all of our torrent client/rss aggregator woes fleshed out and out of the way, but we still have one little extra that we can do. After setting up auto ssh authentication (this can be found anywhere on google) from the raspberry pi to your obviously linux-running computer, you can make a rtorrent_notify.sh script to send a notification or something to your computer for when a torrent completes. My script is really simple:
    ssh user@host 'DISPLAY=:0 notify-send "New episode ready!" "$1"'  

    -Extra Tidbit-
    There is another website that could be used for tracking anime releases called anitor.net but that website really isn't useful for automation either (so it's kind of like BakaBT without the community and other useless stuff). It's pretty much a site that shows the latest releases in a nice list and has some fancy scripting that is nice if you are doing things manually.

    7/18/14

    Raspberry Pi from Three and a Half

    So with our rutorrent and rtorrent set up, we can now move on to tackle more first world problems and start this stuff on boot. The main goal is to get lighttpd and rtorrent up and running when the pi starts up, so that we can instantly go to rutorrent after it finishes booting, and then do a little bit of configuration to rtorrent and rutorrent to smooth out some of the edges.

    First is to install tmux or screen, though which one in particular is a toss-up (and I prefer tmux). After that, we need a systemd service to start tmux/screen and rtorrent, as well as stop it. Of course the arch wiki has a nice entry that you can pretty much copy/paste, though I like keeping the rtorrent as the full name for things rather than rt. In any case, "sudo systemctl enable rtorrent@user.service" and similarly for lighttpd.service will start both at boot so you don't have to do that manually and you can check your rtorrent by ssh'ing in and opening that tmux/screen session.

    We are going to be taking a look at the .rtorrent.rc file to add a couple of extras that we'll need and other things. As a warning, pretty much all of the configurations in the .rtorrent.rc are also available in the Rutorrent webui, but for whatever reasons (maybe some permissions problems somewhere) it doesn't seem to save those configurations across reboots. So things like the download directory (best to set to the highest folder in the hierarchy of your anime), session directory, port range, port random, encryption, etc. should be set using the .rtorrent.rc file (and you should set them). At the very end of this file, we are also adding two lines:

    execute = {sh,-c,/usr/bin/php /srv/http/rutorrent/php/initplugins.php &}
    system.method.set_key = event.download.finished,notify_me,"execute=~/.cache/rtorrent/rtorrent_notify.sh,$d.get_name="

    The first line is to load the plugins for rutorrent when rtorrent starts up so our feeds start up. The second line on the other hand is COMPLETELY OPTIONAL and is pretty much just executing a little script called "rtorrent_notify.sh" after a torrent finishes downloading. Supposedly with a little magic and some bash, you can send a great little notification to your computer from your raspberry pi that tells you when a new episode is ready.

    The rest of the configuration can all be done with rutorrent and some time should really be put to exploring all of the settings available, but there are some quick things that I will highlight:
    • General>User Interface>Theme (the oblivion or dark themes look pretty nice)
    • Ratio Groups>Any number
    The first bullet is just a preference thing, but the second is half of the staple way of automatically removing torrents from rtorrent when it's finished downloading. It's fairly easy to understand, just name the ratio to any name, choose a minimum percentage that you want to seed back to your peers, maximum doesn't really matter, a minimum amount in MBs that you want to seed back, and for how long (or just ignore the time all together), and then set the action to remove. If you wanted to be a real asshole, you could set all of it to zero and then as soon as your file finishes downloading, it gets removed or you could be a decent person and seed until you have given as much as you have received. To complete this automatic removal, we need to make sure that every torrent gets set to this ratio, and we can do that with the Rules Manager (button right next to the help, second option).

    Pretty much just make a new rule where "if the torrent label contains <blank>", set the ratio to your new ratio. And by blank, I literally mean just a blank entry. With that, almost everything is taken care of in terms of our torrent client and we can look at the way we are going to be automagically adding new torrents to our heavily under-powered torrent box.

    7/17/14

    Raspberry Pi from Three and a Fourth

    So getting rutorrent onto a raspberry pi is not nearly as amazingly easy as deluge, but hopefully it will be better in the end. Since a lot of the typing work has already been done, I'll just link to the arch wiki which should get you most of the way there. Just make sure to copy the template .rtorrent.rc to your home directory with "cp /usr/share/doc/rtorrent/rtorrent.rc ~/.rtorrent.rc".

    After following the wiki, it brings you to the point where things almost fully work, but the log of rutorrent (when you open it in a web browser) gives you some of the issues it encountered.

    The first of these might be something along the lines of the rtorrent user needing to have read/write permission to the tmp directory. Now I'm no expert in dealing with permissions, but to make things simple and quick to fix, just make a new directory in the /tmp folder with "sudo mkdir /tmp/rt" and then change it's permissions with "sudo chmod 777 /tmp/rt". Finally, taking a quick visit to /srv/http/rutorrent/conf/config.php, at the very end there is a line that says "$tempDirectory = null;" which you change to "$tempDirectory = '/tmp/rt';". Instantly problem solved.

    The other issues that probably got logged were about the plugins. Some of these plugins you might want to disable (like the rutracker_check one), and if you want the other plugins (mediainfo, screenshots, unpack plugin), just install the packages that they are asking for (mediainfo, ffmpeg, unzip, and unrar respectively). The mediainfo, unzip, and unrar packages are pretty small in comparison to ffmpeg, and have their uses in other places as well...ffmpeg on the other hand is about 120MBs, but I'm still going to probably install it anyways. Now is also a good time to take a look through all of the plugins available in rutorrent (all the non-3rd-party ones anyways) and disable unneeded ones. It's not a huge hit in performance leaving them on, but meh, I'll take anything to lighten the load.

    Now these problems are only what rutorrent can show you. There are more problems hidden in the /var/log/lighttpd/error.log that you can also spend time fixing :D. Most of the fixing is going to be in the /etc/php/php.ini, so open that up somehow and we want to add some extra directories to that open_basedir line after "/usr/bin/" to get our disk space plugin to work. Just change the end to "...:/usr/bin/:/:/usr/local/bin/:/usr/local/sbin/" but don't close the config file just yet.

    Next is to fix the issue that get's spammed into the lighttpd error log about the time not being set. If you are using nano, use ctrl+w to open the search function and search for "date.timezone". This will bring you to the setting in the config where you want to uncomment the ";date.timezone =" and add your timezone to the end. In my case, I change it to "date.timezone = America/Los_Angeles" and the value for you is just the same as when you set up your timezone on the raspberry pi. After that, you can save the config, kill any php-cgi that might be running, maybe reload the systemctl daemon, restart lighttpd and give your rutorrent install another check.

    Finally, we can clean up the horrid mess we made of everything and make things a bit nicer with starting at boot.