spacer
spacer search

SwissCenter

Search
spacer
Main Menu
Home
Documentation + FAQ
Screenshots
Downloads
Forums
Bug Tracking
History
Login
Username

Password

Remember me
?
No account yet?

Locations of visitors to this page

 
Home arrow Forums

SwissCenter Forums  


Manual to install Swisscenter on Synology DSx07 - 2008/03/10 18:47
UPDATE 2008-10-05: firmware DSM 2.0-0702, SwissCenter 1.21.1

Please find below a manual to install SwissCenter on a Synology DS x0x and CS 407. This manual has been tested and all features of SwissCenter work, except for photo streaming. This part is under progress (see ticket #138).

[1] enable Web Station, PHP and MySQL in the Network Services menu of the DS. The option to enable "register_globals" (related to the PHP configuration) must be unchecked.

[2] copy the SwissCenter files and paste the files
in /volume1/web/svr/swiss/. This may be any other directory on /volume1/web/

[3] telnet the DS and log in as root
create a virtual host in file httpd.conf-user by
cd /usr/syno/apache/conf
vi httpd.conf-user
after line 394 insert the following
(NOTE: the editor starts after giving command: I)
Code:

 Listen 8050    <VirtualHost _default_:8050>       DocumentRoot "/volume1/web/svr/swiss"       <Directory "/volume1/web/svr/swiss">             Options Indexes FollowSymLinks MultiViews             AllowOverride None             Order deny,allow             Deny from all             Allow from «« enter first three,two or one octets of your network IPeg 192.168.1 »»       </Directory>       <IfModule mod_dir.c>             DirectoryIndex index.html index.php       </IfModule>       Alias /root"/"    </VirtualHost>

close http.conf-user with ESC followed by ZZ
(NOTE: the port in the example is set to 8050, however, it can be anything except for port 8080 which is already in use by the CS/DS)

[4] restart Apache by
Code:

 sh /usr/syno/etc.defaults/rc.d/S97apache-user.sh restart


[5] create symbolic links for the commands that SwissCenter uses in the /usr/syno/bin/ directory by
cd /usr/syno/bin/
Code:

 ln -/bin/ls /usr/syno/bin/ls


[6] set the permissions for the SwissCenter-files
cd /volume1/web/svr/
Code:

 chown -R admin:users swiss chmod -R 777 swiss


[7] allow streaming of video files by adjusting the "open_basedir"-function of the PHP.ini file on row 205 by
adding "/:"
cd /usr/syno/etc/
vi php.ini
add on line 205
Code:

 /:

(just before "/volume1/web:")

[8] in order to have sound, function exec() needs to be enabled by:
removing /usr/syno/bin/ from line 184: safe_mode_exec_dir = /usr/syno/bin, so change
Code:

 safe_mode_exec_dir = /usr/syno/bin

into
Code:

 safe_mode_exec_dir 


close php.ini with ESC followed by ZZ

[9] restart Apache by
Code:

 sh /usr/syno/etc.defaults/rc.d/S97apache-user.sh restart


[10] store your media files either somewhere on /volume1/ or (eg. /volume1/music/, /volume1/photo/ or /volume1/video/)

[11] enabling the “PLAY NOW”-screen
There are a couple of steps you have to take. First, create within the main SwissCenter directory a sub-directory “/fonts”. In this directory you store so-called GDF fonts. A couple of them can be downloaded from here, unzip the fonts and save them in your SwissCenter directory “/fonts”. In this directory you store so-called GDF fonts. The download contains “arial” fonts for a 624x496 resolution. In case of a different resolution you have to create your own fonts. The logging will report which font size is missing. An instruction how to do this you may find on the same web page.

Now file /base/image.php needs to be edited. Replace line 369-444 with this (replacing function text(), get_text_width() and get_text_height()):

Now file /base/image.php needs to be edited as follows:
Code:

    // ------------------------------------------------------------------------------------------------   // Outputs some text onto the image (using truetype fonts).   // NOTE: The font-size given should be specified in pixels.   // ----------------------------------------------------------------------------------------------- --   function text ($text$x 0$y 0$colour 0$size 14$font ''$angle )   {     // Exit value of this function.     $result false;          // Determine the font to use if not specified.     if (empty($font))       $font get_sys_pref('TTF_FONT');     // Write the text to the image     if ($this->image !== false)     {       // Determine which font type we have       $extension file_ext($font);       if ($extension == "ttf")       {         // GD version 2 takes the font-size argument in points, whereas this function takes the          // text size in pixels. We therefore need to convert the given value before passing to GD.         if (gd_version() >=3)           $size *= 0.8;              $result = @imagettftext($this->image,$size,$angle,$x,$y,$colour,$font,$text);         if ( $result == false )         {             send_to_log(5,"Unable to use Truetype Font '$font' to display '$text'");         }       }       elseif($extension == "gdf")       {         $font sprintf($font$size);         $font_no = @imageloadfont($font);         if ($font_no !== false)         {             // Correct x and y             if($angle == 0)             {                 $y -= imagefontheight($font_no);                 $result imagestring($this->image$font_no$x$y$text$colour);                 if ($result == false)                 {                     send_to_log(5,"Unable to use GD Font '$font' to display '$text'");                 }             }             elseif($angle == 90)             {                 $y -= imagefontheight($font_no) * strlen($text);                 $result imagestringup($this->image$font_no$x$y$text$colour);                 if ($result == false)                 {                     send_to_log(5,"Unable to use GD Font '$font' to display '$text'");                 }             }         }         else         {             send_to_log(5,"Unable to use GD Font '$font' to display '$text'");         }       }              $this->src_fsp  false;     }     return $result;   }      /**    * Returns the width (in pixels) of the text when rendered    *    * @param string $text    * @param integer $size    * @param string $font    * @param integer $angle    * @return integer    */      function get_text_width$text$size 14$font ''$angle 0)   {     if (empty($font))       $font get_sys_pref('TTF_FONT');            $extension file_ext($font);     if ($extension == "ttf")     {        if (gd_version() >=3)          $size *= 0.8;        $box = @imagettfbbox($size$angle$font$text);        return ($box[2] - $box[6]);     }     elseif($extension == "gdf")     {       $font sprintf($font$size);       $font_no imageloadfont($font);       if ($font_no !== false)       {         return (imagefontwidth($font_no) * strlen($text));       }     }   }      /**    * Returns the height (in pixels) of the text when rendered    *    * @param string $text    * @param integer $size    * @param string $font    * @param integer $angle    * @return integer    */   function get_text_height$text$size 14$font ''$angle 0)   {     if (empty($font))       $font get_sys_pref('TTF_FONT');            $extension file_ext($font);     if ($extension == "ttf")     {       if (gd_version() >=3)         $size *= 0.8;            $box = @imagettfbbox($size$angle$font$text);       return ($box[3] - $box[7]);     }     elseif($extension == "gdf")     {       $font sprintf($font$size);       $font_no imageloadfont($font);       if ($font_no !== false)       {         return imagefontheight($font_no);       }     }   }      // ----------------------------------------------------------------------------------   // Truncates a string to the given width (in pixels)   // ----------------------------------------------------------------------------------   function shorten($text$width$size 24)   {     if(empty($text))         return $text;     $short_string "";     $len          0;     $text         = (string)$text;     $continue true;     $trimmed false;     $short_string $text;     while($continue)     {       $len $this->get_text_width($short_string$size);       if ($len $width)       {         if ($trimmed)         {           // Trim the string back to the last whitespace (max 8 chars will be trimmed)           if ((strlen($short_string) - strrpos($short_string,' ')) <10)           {             $short_string substr($short_string0strrpos($short_string,' ')+1);           }         }         $continue false;       }       else       {         // Remove last char         $short_string substr($short_string0, -1);         $trimmed true;       }     }     return $short_string;   }

File "/base/image.php" can be downloaded from the same place.

[12] optimizing the screen lay-out
As the GDF-fonts differ from the standard fonts used by SwissCenter the code of file /base/image_screens.php adjusted a bit.

line 87
Code:

    $title_text_size  font_size22SCREEN_COORDS);

line 168-169
Code:

    $text_y           convert_y(225,SCREEN_COORDS);     $text_width       convert_x(255,SCREEN_COORDS);

line 199-203
Code:

    $time_text_width     convert_x(860,SCREEN_COORDS);     $time_text_x         convert_x(80,SCREEN_COORDS);     $time_text_y         max($text_y,convert_y(640,SCREEN_COORDS));     $image->rectangle($title_x$time_text_y convert_x(850,SCREEN_COORDS), convert_y(2,SCREEN_COORDS), $title_text_col);     $time_text_y        += convert_y(80,SCREEN_COORDS);

line 245-256
Code:

      $image->text(str('TRACK_LENGTH'), $time_text_xconvert_y(935 $adjust_y,SCREEN_COORDS), $title_text_col$detail_text_size);       $image->text(hhmmss($current_track["LENGTH"]), $time_text_xconvert_y(975 $adjust_y,SCREEN_COORDS), $detail_text_col$detail_text_size);     }          // Total so far     if ($tracks != '')     {       $total_label  convert_x(920,SCREEN_COORDS) - $image->get_text_width(str('TRACKS'),$detail_text_size);       $total_detail convert_x(920,SCREEN_COORDS) - $image->get_text_width($tracks,$detail_text_size);          $image->text(str('TRACKS'), $total_labelconvert_y(935 $adjust_y,SCREEN_COORDS), $title_text_col$detail_text_size);       $image->text$tracks $total_detailconvert_y(975 $adjust_y,SCREEN_COORDS), $detail_text_col$detail_text_size);


For your convenience the “/base/image_screens.php”-file can be retrieved (again) from here.

[14] open the SwissCenter configuration screen by entering http://your_server_ip:8050/config. For further details see "docmentation and FAQ".

[15] after entering your media location you may find the "search for new media"-option does not optimally work;
in stead you can do the media search manually by entering the following URL on your PC:
Code:

 http://diskstation:8050/media_search

your web browser starts searching for your media files
when finished, your web browser will mention that the web page cannot be found

[16] add server on ShowCenter
go to the configuration screen of the ShowCenter and select option add server
enter the ip and port of the DS
Code:

 diskstation:8050


make the DS server your default


NOTE: ENABLING function exec() IN STEP [8] MAY CAUSE SECURITY RISKS RE YOUR WEB SERVER!!! In my post of 19/08/2008 below, a couple of protection methods are explained

---------------------------------------------------------------------------
SwissCenter SVN 1091
Simese 1.40 / PHP 4.4.4 / MySQL 4.0.21 / Windows XP
Apache 2.2.8 / PHP 5.2.6 / MySQL 5.0.51b / Linux Synology 2.6.15
Synology DS107+ (128), firmware: DSM 2.0-0702
Pinnacle SC200
  | | The administrator has disabled public write access.

      Topics Author Date
    thread link
Manual to install Swisscenter on Synology DSx07
klaasvaak 2008/03/10 18:47
    thread link
thread linkthread link Re: Manual to install Swisscenter on Synology DSx0
hanamail 2008/03/24 07:21
    thread link
thread linkthread linkthread link Re: Manual to install Swisscenter on Synology DSx0
klaasvaak 2008/03/24 08:16
    thread link
thread linkthread linkthread linkthread link Re: Manual to install Swisscenter on Synology DSx0
klaasvaak 2008/04/23 17:57
    thread link
thread linkthread linkthread linkthread linkthread link Re: Manual to install Swisscenter on Synology DSx0
chrisrixon 2008/04/25 14:59
    emo
thread linkthread linkthread linkthread linkthread link Re: Manual to install Swisscenter on Synology DSx0
chrisrixon 2008/04/25 15:07
    thread link
thread linkthread linkthread linkthread linkthread linkthread link Re: Manual to install Swisscenter on Synology DSx0
klaasvaak 2008/04/25 15:26
    thread link
thread linkthread linkthread linkthread linkthread linkthread linkthread link Re: Manual to install Swisscenter on Synology DSx0
chrisrixon 2008/04/25 17:51
    thread link
thread linkthread linkthread linkthread linkthread linkthread linkthread linkthread link Re: Manual to install Swisscenter on Synology DSx0
klaasvaak 2008/04/25 18:33
    thread link
thread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread link Re: Manual to install Swisscenter on Synology DSx0
chrisrixon 2008/04/25 18:38
    thread link
thread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread link Re: Manual to install Swisscenter on Synology DSx0
klaasvaak 2008/04/26 08:31
    thread link
thread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread link Re: Manual to install Swisscenter on Synology DSx0
chrisrixon 2008/04/26 11:14
    thread link
thread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread link Re: Manual to install Swisscenter on Synology DSx0
chrisrixon 2008/04/26 14:34
    thread link
thread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread link Re: Manual to install Swisscenter on Synology DSx0
klaasvaak 2008/04/26 15:46
    thread link
thread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread link Re: Manual to install Swisscenter on Synology DSx0
chrisrixon 2008/04/26 18:19
    thread link
thread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread link Re: Manual to install Swisscenter on Synology DSx0
chrisrixon 2008/04/27 03:27
    thread link
thread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread link Re: Manual to install Swisscenter on Synology DSx0
chrisrixon 2008/05/23 13:15
    thread link
thread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread link Re: Manual to install Swisscenter on Synology DSx0
klaasvaak 2008/05/23 14:48
    thread link
thread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread link Re: Manual to install Swisscenter on Synology DSx0
chrisrixon 2008/05/23 15:07
    thread link
thread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread link Re: Manual to install Swisscenter on Synology DSx0
klaasvaak 2008/05/23 15:55
    thread link
thread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread link Re: Manual to install Swisscenter on Synology DSx0
chrisrixon 2008/05/23 16:50
    thread link
thread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread link Re: Manual to install Swisscenter on Synology DSx0
klaasvaak 2008/05/23 18:16
    thread link
thread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread link Re: Manual to install Swisscenter on Synology DSx0
chrisrixon 2008/05/24 04:29
    thread link
thread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread link Re: Manual to install Swisscenter on Synology DSx0
klaasvaak 2008/05/24 13:15
    thread link
thread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread link Re: Manual to install Swisscenter on Synology DSx0
chrisrixon 2008/05/24 14:48
    thread link
thread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread linkthread link Re: Manual to install Swisscenter on Synology DSx0
Dutchsea 2008/05/30 09:17
    thread link