Sunday, March 8, 2015

Installing IceFilms (and other) Channel(s) on your Synology DiskStation Plex Media Server



So, have you been looking for the IceFilms channel plug-in for your Synology DiskStation, but only seen Windows and Mac OSX referenced for install methods on the sites you've visited?

Well, look no further!

I installed IceFilms on my Synology DiskStation tonight (which, in reality, is a server I built running XPEnology, but on a software/OS-level, it isn't any different than a DSM x86 unit).

It appears to be working without a hitch!  I know you've probably been dying to install IceFilms (as I know I was!), so I thought I should probably share how to do it:


Assumptions:

1) You know a little bit about how to navigate using a UNIX-style command line interface.
2) You have SSH enabled on your NAS.  If you don't, please visit this site to find out how.
3) You have a method of connecting to your SSH-enabled NAS, such as using PuTTY for Windows, or the Terminal in Mac OS or Linux.  Download PuTTY HERE.
4) You have the Plex Media Server package installed on your Synology DiskStation NAS.  If you need to install it on your NAS, please download the latest version here and install it manually as this is the best way to ensure that the package is up-to-date.  (To do this, you may have to allow plug-ins from any source in your Synology Package Manager).


Quick guide for less techincally-inclined readers:   *Confirmed working!* The easiest way to do this is to download the zip and rename IceFilms.bundle-master to IceFilms.bundle move it to your Plex Media Center Plug-Ins directory, and re-start your Plex Server.  Here's a quick walk-through:


Step one:  Navigate to the Git repository for the IceFilms.bundle package:

https://github.com/ReallyFuzzy/IceFilms.Bundle


Step two: Click on "Download ZIP" at the bottom-right corner of the page.  Unzip this and it will give you a folder called IceFilms.bundle-master  




Step three:  Rename the IceFilms.bundle-master folder to IceFilms.bundle and copy it to your synology diskstation.  We'll use /volume1/home/ as an example.






Plex user folder, under the path:  /volume1/Plex/ 


Step four:  After copying the IceFilms.bundle package to your home folder, open your terminal and navigate to your server by typing ssh root@(server address):



Quick tip:  Log to Synology SSH using your admin password.

Navigate to your home directory (e.g. /volume1/homes/username/ ) and move the .bundle file to the Plex Library folder:

NA$ mv /volume1/homes/avery/IceFilms.bundle/ /volume1/Plex/Library/Application\ Support/Plex\ Media\ Server/Plug-ins/

Notes: You can hit "tab" in most terminals to auto-complete the name of a directory.  The forward-slash indicates that there is a space in the name of the path or file.


Step five:  Navigate to your Synology DiskStation manager in your browser and open Package Center.  Navigate to your installed packages and click on Plex Media Server.  Under the Actions drop-down menu, choose "Stop".  Then click the Actions menu again and choose "Run".



Now, if all went well, you should be able to go to your Plex Media Center in your browser, or Plex Media Theater, etc. and see "IceFilms" as one of your channels.



It's as simple as that!

TIP:  Look in ReallyFuzzy's GitHub page to find other plug-ins, as well!


Now, here's the more involved method I used (I can personally verify that both of these methods work):

Caveats: This more complicated guide is only useful for those who
1) Have an interest in obtaining and installing bootstrapper and ipkg package management functionality for their Synology DiskStation
2) Have an interest in having Git clone functionality for their Synology DiskStation

If neither of these apply to you, I suggest you just follow the easy guide above!


Install Git on your Synology NAS by using ipkg.  This will enable the ability to get the latest build of the IceFilms.bundle file required for the IceFilms Plex Media Server channel.  

Note:  installing and using the ipkg package management infrastructure is beyond the scope of this post.  To learn more about using a bootstrapper and ipkg on your system, please visit:

http://forum.synology.com/wiki/index.php/Overview_on_modifying_the_Synology_Server,_bootstrap,_ipkg_etc

I also found this forum post helpful (note the post by "LittleLama"):

http://xpenology.com/forum/viewtopic.php?f=2&t=2564

I prefer using Nano to VI, which you can install using ipkg prior to doing the steps explained in the link above for editing your configuration files.  Also, I prefer using the command EXPORT for setting the env for the ipkg path, rather than rebooting to acquire the PATH variable (as recommended in the LittleLama post I referenced).

Try it by entering the following and you should be able to run ipkg from anywhere:

NA$ export PATH=/opt/bin:/opt/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/syno/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/syno/bin:/usr/syno/sbin:/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/syno/bin:/usr/syno/sbin:/usr/local/bin:/usr/local/sbin


Note: I am using NA$ to signify the command prompt, as the "less-than" sign is not displayed in blogger - you will see a "less than" sign at the end of your server name for the display of your command prompt of your NAS.


If you use export, you do *not* need to reboot in order to use ipkg.  Then invoke:

NA$ ipkg update 

And

NA$ ipkg upgrade


Install Bash for a more familiar command line interface:

NA$ ipkg instal bash

then run it by invoking:

NA$ bash


Now you will see the # sign as your command prompt, which signifies that you have root access (note - you already HAD root access, but this is the more common convention seen in *NIX OS).

Add a couple lines to your to log-in with Bash next time you SSH to the server by invoking:

# nano /etc/profile

and adding a line that says the following:

[ -e /opt/bin/bash ] && /opt/bin/bash


Also add the line

PATH=$PATH:/opt/bin:/opt/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/syno/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/syno/bin:/usr/syno/sbin:/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/syno/bin:/usr/syno/sbin:/usr/local/bin:/usr/local/sbin

to avoid having to "export PATH=" next time you log-in --- make sure you delete any other references to PATH in this file (There was one at the end of mine). 

Quick tip:  You can also have Bash show you the current directory you're in by invoking:

# nano /root/.bashrc

and adding a line that says

PS1='\w\$ '


Bind the /volume1/@optware directory to your /opt folder:

# nano /etc/fstab


Add the following:

/volume1/@optware /opt none defaults,bind 0 0


Exit by pressing CTRL-X and save changes.


And permit a user environment in your /etc/sshd_config

# nano /etc/ssh/sshd_config

Find the line that says #PermitUserEnvironment no by pressing CTRL-W and typing in part of the string.  Uncomment it by removing the # sign and enable it by changing no to yes.  Exit by pressing CTRL-X and save changes.


Restart SSHD

synoservicectl --reload sshd


And you should be good to go!


Now for the fun stuff!

Log back into your DiskStation using SSH (same as above)


Install Git by using Ipkg to download the package:

# ipkg install git


Navigate to the Plex Plug-ins directory by invoking:

# cd /volume1/Plex/Library/Application\ Support/Plex\ Media\ Server/Plug-ins/


Then clone the IceFilms.bundle file by invoking: 

# git clone https://github.com/ReallyFuzzy/IceFilms.bundle.git

Note: You can copy the URL from the bottom-right corner of the github page:

https://github.com/ReallyFuzzy/IceFilms.Bundle


Verify that the IceFilms.bundle file has been copied by invoking:

# ls 


You should see IceFilms.bundle listed amongst the other plug-ins (.bundle files) in your plug-ins directory. 

Now go to your DSM home page and open "Package Center".  Navigate to your installed packages and click on Plex Media Server.  Under the Actions drop-down menu, choose "Stop".  Then click the Actions menu again and choose "Run".  

Navigate to your Plex Media Center and look at your channels.  You should see that IceFilms has been installed.

This is the best way to install plug-ins to Plex on your Synology DiskStation, as now you can simply invoke # git clone [URL] to clone any package you want!  Just don't forget that you have to restart your Plex Media Server before using the new plug-ins.



Any questions?  Want any further explanations?  Please leave a comment!  

Thanks for reading!


Wednesday, March 4, 2015

Compiling Gnumeric on Mac OS 10.9.5

Compiling Gnumeric on Mac OS 10.9.5


Note:  No X11 was used in the installation of this Gnumeric port!  While you may be instructed to install XQuartz at some point during your MacPorts experience, it is NOT necessary for this particular package (if you follow the instructions properly).  


Hi everybody,



So, if you know anything about *NIX spreadsheet programs, or you are a hardcore statistics nerd, you are probably familiar with Gnumeric.

I like to run several operating systems, and one of my favorite is Mac OS.  But I like Gnumeric quite a bit and there's never been an installer package for a native port of Gnumeric for Mac OS as far as I know.

There IS a how-to on how to compile Gnumeric using MacPorts, though!  However, it's a little outdated:

Open Source Packages for the Macintosh 

I was really glad to see this as a starting place, as it has some info about how to use flags when porting software to compile in Quartz instead of X11 (thus, to avoid the nasty X11 interface and stay more over-all "Mac-Looking")

Following the directions on the site did not work for me, however -- so here's an update to help people with more modern Mac OS versions (I did this under Mac OS 10.9.5 Mavericks with MacPorts 2.3.3).

MacPorts Quickstart Guide

Installing and using MacPorts is beyond the scope of this article, but it's not too hard to do - just make sure you have the latest (or most appropriate) version of Xcode, including the command-line tools.  you can check to see if you have the Xcode command line tools by opening a terminal, and invoking the command:

$ gcc


After a brief pause, you should see the following:


clang: error: no input files


So far, so good!  So now, install MacPorts using the Quickstart guide link provided above, and you should be in business.

After you've installed MacPorts, you're going to need to install some dependencies. Go to the terminal prompt again and type:

$ sudo port install -v cairo +quartz+no_x11


You should see MacPorts downloading and installing the cairo package on your behalf.  I like to use the -v flag so it returns a little more information, but it's not necessary.

The +quartz+no_x11 flags are to tell the packages to build such that they do not need to use XQuartz (which, should be rather important since you probably don't have it installed!  X11 is not included by default on Mac OS versions released after Mountain Lion). 

If that all worked properly, next we're going to want to install some more dependencies.  Go back to your prompt and invoke the following:

$ sudo port uninstall -f pango


We're going to remove pango since it has been installed using X11 dependencies.  You cannot install pango using the +quartz+no_x11 flags unless this package has been uninstalled, and to make it uninstall without removing its dependencies (a hassle), you use the -f flag to force the uninstall. 

Now that pango's been removed, let's re-install it using our +quartz+no_x11 flags, by invoking:

$ sudo port install -v pango +quartz+no_x11


There, now pango's been installed the way we would like!  Using Quartz, instead of X11.  

Now do the same for GTK3 -- remove it by invoking the following:

$ sudo port uninstall gtk3


That will get rid of the X11-dependent gtk3 engine, so we can re-install it with Quartz dependencies, by invoking, yep - you guessed it:

$ sudo port install -v gtk3 +quartz+no_x11


Starting to get the idea?  We're making sure this Gnumeric install is going to be dependent on Quartz, and not X11 -- so it's got the most Mac-like appearance.  

Now let's go back to the prompt and install two more dependencies before building Gnumeric.  Go to your prompt and invoke:

$ sudo port install -v poppler +quartz+no_x11 


to install Poppler, which is used to render PDFs inside Gnumeric, and

$ sudo port install -v gnome-themes-standard +quartz+no_x11 


Which is necessary for installing adwaita-icon-theme, icon-naming-utils and other appearance-related dependencies.  

Note:  This package installs GTK2, as well, but since we invoked the install it should be compiled with the same  +quartz+no_x11 flags as its parent.


Now that you've got the dependencies installed, now it's time to compile Gnumeric!

$ sudo port install -v gnumeric +quartz+no_x11


Doesn't take that long compared to the GTK+ packages that you installed earlier.  After it's done compiling, invoke:

$ gnumeric


to give it a spin!


OK, now if it's working, here's a quick-and-dirty way to create a link so that you can open it via an icon.

Go back to your terminal and invoke:

$ ln -s /opt/local/bin/gnumeric /Applications/Gnumeric


Navigate to your Applications folder via the Finder and you should see a blank icon named "Gnumeric".

Double click on the icon, and you should be prompted with a dialog asking you to choose an application to run the program with.   Select the option to choose the program, then select the Terminal as the program to run it with (under /Applications/Utilities/Terminal).

Now when you double-click on this icon it should run Gnumeric for you without having to enter the terminal.



Alternately, you can create an alias instead of a link, by invoking:

$ osascript -e 'tell application "Finder"' -e 'make new alias to file (posix file "/opt/local/bin/gnumeric-1.12.20") at desktop' -e 'end tell'


This does NOT require the step of having to choose the terminal to run it with.  Now the Gnumeric alias will be on your desktop.  You may rename it and move it wherever you like (e.g. the Applications folder). 



Any questions or comments to improve this post are immensely appreciated!  Please leave a post!  Thank you!


Note: I've noticed some of the functions, such as creating check boxes, radio buttons, and lists, do not work and actually crash the program.  I am not sure if these would work in the X11-compiled version, as I have not tried it in a number of years.  Please submit your comments regarding whether or not you have compiled Gnumeric on a Mac using X11, and if these functions work properly in that version.  Also, if you have any ideas of how to fix these functions, I'd be more than happy to hear them!