Author Topic: Transmission torrent on LinuxMCE  (Read 5625 times)

robwoodward75

  • Regular Poster
  • **
  • Posts: 48
    • View Profile
Transmission torrent on LinuxMCE
« on: July 30, 2013, 04:46:33 pm »
All,

Not sure if this is the right place to put this, but I have recently spent a lot of time including transmission-daemon and some download management tools into the Linux MCE web admin site.  I have tried best I can to keep the theme as per the rest of the site, apart from the Transmission-daemon server connection, which is as per the transmission daemon installation.  There are pages on there to create symbolic links from either file or directory level to another folder (in my case, I was fed up with all the Sample.avi etc etc etc) appearing on Media Tomb, hence the symbolic links to just the movie!!  There is also built in an unrar, which most of the downloads appear to be.

The installation tool checks for transmission-daemon, and unrar, offering to add them in if they are not installed, adds a new database into MySQL called "transmission_links", and adds the menu option into Advanced > Configuration, then copies all the necessary web and scripting files into the relevant places.

In my set-up, I have put transmission-daemon's setting (/etc/transmission-daemon/settings.json) to use /home/public/torrents folder in my set-up, and my mediatomb only looks at /home/public/data.


WARNING!!!
Due to the new web pages, index.php will be replaced, as will include/config/database.inc.php and include/config/globalconfig.inc.php, so, if you have made any changes to these files, please be careful!!!  Back-up copies will however remain in their location with the date and time stamp after the file name so you can return to "normal" afterwards, similar to: index.php-20130729165423.bak.

Disclaimer
I accept no responsibility for loss of data, so please be sure to read through the install script prior to running, if you feel happier, then create the database and user, and copy the files manually.



Hope you like the layout, I will continue to try to work on advancing the layout and interface, and would appreciate any input from the outside world!
« Last Edit: August 01, 2013, 02:48:06 pm by robwoodward75 »

posde

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 3062
  • Wastes Life On LinuxMCE Since 2007
    • View Profile
    • My Home
Re: Transmission torrent on LinuxMCE
« Reply #1 on: July 30, 2013, 04:57:52 pm »
Do you think it makes sense to provide an svn diff of what you did and create a trac ticket?

robwoodward75

  • Regular Poster
  • **
  • Posts: 48
    • View Profile
Re: Transmission torrent on LinuxMCE
« Reply #2 on: July 30, 2013, 05:00:48 pm »
Hi Posde,

If I had the slightest idea how to do that, then I would!!  If you can point me to a suitable set of destructions to follow, I'de be glad to do that, if that's the preferred method.

Thanks for taking the time to look.

WhateverFits

  • Guru
  • ****
  • Posts: 229
    • View Profile
    • Sean Walker
Re: Transmission torrent on LinuxMCE
« Reply #3 on: July 30, 2013, 08:42:46 pm »
Get the source tree for the website:
http://wiki.linuxmce.org/index.php/Source_Code

It will be under the web folder in the subversion tree.

Unpack your file over the top of the stuff there. Then do:

svn diff > patchfile

and make sure it actually worked and then create a ticket here:
http://svn.linuxmce.org/

and attach the file. Don't forget to post your ticket number back here so people know about it quicker.  ;D

robwoodward75

  • Regular Poster
  • **
  • Posts: 48
    • View Profile
Re: Transmission torrent on LinuxMCE
« Reply #4 on: July 30, 2013, 11:23:29 pm »
OK, did up to the raising of the Trac ticket, but the svn diff left me a little worried, in that it appears that there have been changes since my install, and I don't want to put something in which shows new changes being replaced with old stuff, effectively undoing other peoples work.  Here is the output of the svn diff, and it shows replacing lines, which I hadn't replaced.  Also, it doesn't include the new files I created?!  Any Suggestions?!  or is this what you expected to see?!  Sorry, first time doing this!!

Code: [Select]
Index: lmce-admin/include/config/database.inc.php
===================================================================
--- lmce-admin/include/config/database.inc.php (revision 27776)
+++ lmce-admin/include/config/database.inc.php (working copy)
@@ -26,6 +26,10 @@
   $securityADO = &ADONewConnection($dbPlutoSecurityType);
   $securityADO->NConnect($dbPlutoSecurityServer,urlencode($dbPlutoSecurityUser),urlencode($dbPlutoSecurityPass),urlencode($dbPlutoSecurityDatabase));
 
+ // TransmissionADO connection
+ $transmissionADO = &ADONewConnection($dbTransmissionType);
+ $transmissionADO->NConnect($dbTransmissionServer,urlencode($dbTransmissionUser),urlencode($dbTransmissionPass),urlencode($dbTransmissionDatabase));
+
   //for sqlite
   //$db = &ADONewConnection('sqlite');
   //$db->NConnect($GLOBALS['appRoot'].'sqlite.db'); # sqlite will create if does not exist
Index: lmce-admin/include/config/globalconfig.inc.php
===================================================================
--- lmce-admin/include/config/globalconfig.inc.php (revision 27776)
+++ lmce-admin/include/config/globalconfig.inc.php (working copy)
@@ -32,6 +32,13 @@
  $dbPlutoSecurityServer = $DB_HOST;
  $dbPlutoSecurityDatabase = "pluto_security";
 
+ // Transmission
+ $dbTransmissionType = "mysql";
+ $dbTransmissionUser = "transmission";
+ $dbTransmissionPass = "";
+ $dbTransmissionServer = $DB_HOST;
+ $dbTransmissionDatabase = "transmission_links";
+
 function LoadConfig($configFile,$configKey) {
  //LoadConfig()
  //Looks for the assigned value of $configKey within $configFile,
Index: lmce-admin/index.php
===================================================================
--- lmce-admin/index.php (revision 27776)
+++ lmce-admin/index.php (working copy)
@@ -1078,10 +1078,9 @@
  $output = new Template($dbADO);
  $output->setTemplateFileType('large');
  @include($GLOBALS['globalConfigPath'].'asteriskDB.inc.php');
- @include($GLOBALS['globalConfigPath'].'telecom.inc.php');
      include_once('operations/phones/phoneLines.php');
      $output->setHelpSrc('/wiki/index.php/Phone_Lines');
-     phoneLines($output,$asteriskADO,$dbADO,$telecomADO);
+     phoneLines($output,$asteriskADO,$dbADO);
  break;
  case 'fax';
  $output = new Template($dbADO);
@@ -1801,6 +1800,20 @@
      include_once('operations/deviceTemplate/commMethod.php');
      commMethod($output,$dbADO);    
  break;
+ case 'transmission-daemon':
+ $output = new Template($dbADO);
+ $output->setTemplateFileType('large');
+     include_once('operations/others/transmissionDaemon.php');
+     transmissionDaemon($output,$dbADO,$transmissionADO);    
+     //transmissionDaemon($output,$dbADO,"");    
+ break;
+ case 'transmissionLink':
+ $output = new Template($dbADO);
+ $output->setTemplateFileType('small');
+     include_once('operations/others/transmissionLink.php');
+     transmissionLink($output,$dbADO,$transmissionADO);    
+     //transmissionLink($output,$dbADO,"");    
+ break;
  case 'upnpServer':
  $output = new Template($dbADO);
  $output->setTemplateFileType('large');


WhateverFits

  • Guru
  • ****
  • Posts: 229
    • View Profile
    • Sean Walker
Re: Transmission torrent on LinuxMCE
« Reply #5 on: July 30, 2013, 11:29:21 pm »
OK, well, working with version control systems is a bit of a paradigm shift if you haven't worked with them before.

Normal practice is, of course, to always work with the latest version. In this situation, you cannot as you already started. So, if there are files that you overlaid that you didn't make changes to but somebody else did, simply delete that file and run "svn update" and it will bring back the latest version of the file instead of the version that you changed inadvertently. Run "svn status" to get a list of all modified files. Then you can go through that list and do some basic sanity checks to be sure you are only checking in what is necessary.

I hope that helps!

robwoodward75

  • Regular Poster
  • **
  • Posts: 48
    • View Profile
Re: Transmission torrent on LinuxMCE
« Reply #6 on: July 31, 2013, 10:20:25 am »
I guess this is a lesson in read all the instructions before heading off inventing new things on the site then!

Right,

svn update:
Code: [Select]
At revision 27777
svn status:
Code: [Select]
?       lmce-admin/operations/others/transmissionEditLinks.php
?       lmce-admin/operations/others/transmissionValidatelinks.php
?       lmce-admin/operations/others/transmissionLink.php
?       lmce-admin/operations/others/transmissionDaemon.php
?       lmce-admin/operations/others/transmissionCreatelinks.php
?       lmce-admin/operations/others/transmissionCheckfilename.php
M       lmce-admin/include/config/database.inc.php
M       lmce-admin/include/config/globalconfig.inc.php
M       lmce-admin/index.php
?       lmce-admin/languages/en/transmissiondaemon.lang.php

svn diff:
Code: [Select]
Index: lmce-admin/include/config/database.inc.php
===================================================================
--- lmce-admin/include/config/database.inc.php  (revision 27777)
+++ lmce-admin/include/config/database.inc.php  (working copy)
@@ -26,6 +26,10 @@
   $securityADO = &ADONewConnection($dbPlutoSecurityType);
   $securityADO->NConnect($dbPlutoSecurityServer,urlencode($dbPlutoSecurityUser),urlencode($dbPlutoSecurityPass),urlencode($dbPlutoSecurityDatabase));

+       // TransmissionADO connection
+       $transmissionADO = &ADONewConnection($dbTransmissionType);
+       $transmissionADO->NConnect($dbTransmissionServer,urlencode($dbTransmissionUser),urlencode($dbTransmissionPass),urlencode($dbTransmissionDatabase));
+
   //for sqlite
   //$db = &ADONewConnection('sqlite');
   //$db->NConnect($GLOBALS['appRoot'].'sqlite.db'); # sqlite will create if does not exist
Index: lmce-admin/include/config/globalconfig.inc.php
===================================================================
--- lmce-admin/include/config/globalconfig.inc.php      (revision 27777)
+++ lmce-admin/include/config/globalconfig.inc.php      (working copy)
@@ -32,6 +32,13 @@
        $dbPlutoSecurityServer = $DB_HOST;
        $dbPlutoSecurityDatabase = "pluto_security";

+       // Transmission
+       $dbTransmissionType = "mysql";
+       $dbTransmissionUser = "transmission";
+       $dbTransmissionPass = "";
+       $dbTransmissionServer = $DB_HOST;
+       $dbTransmissionDatabase = "transmission_links";
+
 function LoadConfig($configFile,$configKey) {
        //LoadConfig()
        //Looks for the assigned value of $configKey within $configFile,
Index: lmce-admin/index.php
===================================================================
--- lmce-admin/index.php        (revision 27777)
+++ lmce-admin/index.php        (working copy)
@@ -1801,6 +1801,20 @@
            include_once('operations/deviceTemplate/commMethod.php');
            commMethod($output,$dbADO);
        break;
+       case 'transmission-daemon':
+               $output = new Template($dbADO);
+               $output->setTemplateFileType('large');
+           include_once('operations/others/transmissionDaemon.php');
+           transmissionDaemon($output,$dbADO,$transmissionADO);
+           //transmissionDaemon($output,$dbADO,"");
+       break;
+       case 'transmissionLink':
+               $output = new Template($dbADO);
+               $output->setTemplateFileType('small');
+           include_once('operations/others/transmissionLink.php');
+           transmissionLink($output,$dbADO,$transmissionADO);
+           //transmissionLink($output,$dbADO,"");
+       break;
        case 'upnpServer':
                $output = new Template($dbADO);
                $output->setTemplateFileType('large');


Which I'm a lot happier with, with the exception that I still don't understand how the new files are included, I can see all the mods to the existing files, but not the additional bits, despite svn status recognising they're in there?!

I've then copied the latest of each of the modified files back into my live web area, and all appears to be working OK.  So, of all the work done, the remaining new file, which is not in the web directory is:
/usr/pluto/bin/transmission-settings.sh

do I have to do a similar svn on that area?  if so, where is it, I did look last night, but couldn't find it easily!

Thanks again for all your help and guidance, with any luck I'll do this a bit better in future!!

posde

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 3062
  • Wastes Life On LinuxMCE Since 2007
    • View Profile
    • My Home
Re: Transmission torrent on LinuxMCE
« Reply #7 on: July 31, 2013, 02:04:02 pm »
If you have new files that you would want in svn, you need to svn add the file. After that, they will be included in an svn diff.

robwoodward75

  • Regular Poster
  • **
  • Posts: 48
    • View Profile
Re: Transmission torrent on LinuxMCE
« Reply #8 on: July 31, 2013, 02:35:00 pm »
Excellent, thank you, that's completed the patch for the web admin area (attached), but could you direct me to the correct place to get the /usr/pluto/bin scripts, as I have one to update that area too.

Also, how do I go about the database?  There's a new database added, which I do using the install script in the initial download, create the database, tables and a the new user to access this database?!

Sorry, lots of questions, and I've no idea how many people actually use this, or would even want it?!

Thanks.

davegravy

  • Addicted
  • *
  • Posts: 548
    • View Profile
Re: Transmission torrent on LinuxMCE
« Reply #9 on: August 01, 2013, 08:15:34 am »
Excellent, thank you, that's completed the patch for the web admin area (attached), but could you direct me to the correct place to get the /usr/pluto/bin scripts, as I have one to update that area too.

Also, how do I go about the database?  There's a new database added, which I do using the install script in the initial download, create the database, tables and a the new user to access this database?!

Sorry, lots of questions, and I've no idea how many people actually use this, or would even want it?!

Thanks.

I've got my own duct-taped transmission setup going alongside LMCE, so I'm looking forward to checking your work out.

robwoodward75

  • Regular Poster
  • **
  • Posts: 48
    • View Profile
Re: Transmission torrent on LinuxMCE
« Reply #10 on: August 01, 2013, 01:23:23 pm »
Hi Davegravy,

Hope it doesn't end up to be disappointing then!  If you want to try it, with the previously posted transmission.patch, which should sort out the web stuff, and the attached transmission-settings.sh copied into /usr/pluto/bin/ and then finally, the following commands to set-up the database and add the transmission user:

Code: [Select]
DBName='transmission_links'

#Set up the database
mysql -e "CREATE DATABASE $DBName;"
mysql -e "CREATE TABLE Torrent_Links (Link_ID int NOT NULL AUTO_INCREMENT, Torrent_Location TEXT NOT NULL, Rar_File VARCHAR(250) NULL, Link_Location TEXT NOT NULL, Link_Name VARCHAR(100), Link_Type VARCHAR(10) NOT NULL, Link_Status VARCHAR(10) NULL, PRIMARY KEY (Link_ID));" $DBName

#Adding the user
mysql -e "CREATE USER 'transmission'@'localhost';"
mysql -e "CREATE USER 'transmission'@'127.0.0.1';"
mysql -e "GRANT SELECT, INSERT, UPDATE, DELETE ON transmission_links.* TO 'transmission'@'localhost';"
mysql -e "GRANT SELECT, INSERT, UPDATE, DELETE ON transmission_links.* TO 'transmission'@'127.0.0.1';"
mysql -e "FLUSH PRIVILEGES;"


#Add the new Menu Option
ParentID=`mysql -e "SELECT PK_PageSetup FROM PageSetup WHERE Description='Configuration';" pluto_main |tail -1`

if [ $ParentID -eq 0 ]
then
ParentID=174
fi

OrderNum=`mysql -e "SELECT MAX(OrderNum) + 10 FROM PageSetup WHERE FK_PageSetup_Parent=$ParentID;" pluto_main |tail -1`

#For Safety in case is doesn't correctly identify the outputs
if [ $OrderNum -eq 0 ]
then
OrderNum=999
fi

mysql -e "INSERT INTO PageSetup (FK_PageSetup_Parent, Website, OrderNum, Description, pageURL, showInTopMenu) VALUES ("$ParentID",1,"$OrderNum",'Transmission Daemon','index.php?section=transmission-daemon',1);"

Could do with one of the Guru's or Gods letting me know the preferred method for added these parts in?  Is it just on a track ticket, as I've done here, or is there another way?!
« Last Edit: August 01, 2013, 04:13:25 pm by robwoodward75 »

posde

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 3062
  • Wastes Life On LinuxMCE Since 2007
    • View Profile
    • My Home
Re: Transmission torrent on LinuxMCE
« Reply #11 on: August 01, 2013, 04:29:23 pm »
If you have modified files in /usr/pluto/bin you should checkout the src/BootScripts directory. If you only added files to it, it is okay to add those files to a trac ticket. And try to find someone in IRC chat #linuxmce-devel to take care of it. I am sure there are people in there who love torrents... ;)

robwoodward75

  • Regular Poster
  • **
  • Posts: 48
    • View Profile
Re: Transmission torrent on LinuxMCE
« Reply #12 on: August 01, 2013, 05:01:27 pm »
All,

Ticket raised:
#1861

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5505
  • DOES work for LinuxMCE.
    • View Profile
Re: Transmission torrent on LinuxMCE
« Reply #13 on: August 01, 2013, 07:55:35 pm »
What we should probably do is add a Torrent package to the install wizard_* tables, which inside this package includes the setup scripts, etc.. this way, we can add a row to PageSetup and reference by FK_Package #, so when the torrent package is installed (by selecting it on the CORE software page), it will show the menu item.

-Thom

robwoodward75

  • Regular Poster
  • **
  • Posts: 48
    • View Profile
Re: Transmission torrent on LinuxMCE
« Reply #14 on: August 02, 2013, 12:38:32 pm »
And that is why you're a LinuxMCE God, and I am but a mere mortal!!!

I will definitely need some help and guidance on setting that up, unless your statement was more of a offer to do, rather than an instruction to me?!!

Either way, I'm happy to do my part to include Transmission into LinuxMCE as hopefully a permanent feature, I make good use of it myself as it integrates well with Android, with the free Transmission Remote app allowing me to add, pause etc torrents from anywhere to be available when I get home (speed dependant obviously!).

I am aware that my pages are fairly selfish at the moment, written by me, for me!!  What I could do with is some fresh eyes, and other peoples perspectives on it to see how we can improve, add other features (i.e. I've put unrar in, but made no scope as yet for zip, tar etc etc)  Simply because, of the torrents I've downloaded, I've only come across rar files, mainly multi-part ones at that!!

I can see further scope myself when I have more time, i.e. to incorporate the /etc/transmission-daemon/settings.json file into the DB, and therefore a web page, and therefore controlling the settings as well as starting and stopping the service etc from there.