Jump to content

Tech Support

Administrators
  • Posts

    1,816
  • Joined

  • Days Won

    339

Posts posted by Tech Support

  1. Multiple conversion servers can be used only in KVS ultimate package. They will let you reduce CPU load on main server and make video conversion faster, but only to some point. It is a common misunderstanding to assume that the more conversion servers you add, the more videos can be converted for the same time. This is not always true. The overall conversion speed depends not only on the actual conversion (e.g. video encoding), but on many other factors as well that will be explained in this post.

    KVS conversion engine works in 3 phases, in some cases only 1 or 2 phases are executed and the rest are skipped. But if we speak of processing newly uploaded videos, this is always a 3-phase process:

    1. Main server: prepares conversion task for conversion server and uploads this task to conversion server
    2. Conversion server: executes task
    3. Main server: verifies and finalizes task execution

    Main server cron and conversion server cron are both triggered each 1 minute. It means that any new video will require at least 2 minutes before its conversion is finalized. Even if conversion itself takes couple of seconds, you will have to wait for 2 minutes due to cron limits.

     

    Conversion phase 1

    When phase 1 is executed, in most cases this phase is very fast and all it needs to do is to copy task info and the uploaded video file to conversion server. This may take a while if your source files are huge and your conversion server is remote. The most important thing to understand here is that this phase is always processed in 1 thread. If you have 10 new videos scheduled and 10 free conversion servers, the main cron will have to copy each video to each conversion server 1 by 1 (not in parallel). If copying each video takes 1 minute, your conversion engine will be busy with spending 10 minutes to copy 10 tasks to conversion servers. In this case there is no big difference how many conversion servers you have, because each task takes the whole minute to simply copy it. Your video queue will not be processed faster than 1 * 60 * 24 = 1440 videos per day.

    Remote conversion server settings have an option to cope with this issue, which allows conversion server to download video source files from the main server instead of require main server to copy them to conversion server:

    conversion_pull_source_files.png.c644bb49b26b6ba0d9a9bf0f0e31f54c.png

    This changes the whole picture. Main server will not need to spend 1 minute to copy video source files anymore, instead it will spend only 1 second to copy a small task file. Thus it can copy 10 tasks to 10 conversion servers in less than 10 seconds, so that for the whole minute it can copy up to 60 tasks. Then each conversion server will download source files from main server, but now this will happen in parallel. If you have only 2 remote conversion servers, then they both will download 2 video source files at the same time. But if you have 10 - they will download 10 in parallel. This is a huge speed increase. The only issue here is to make sure that your main server is able to serve so many files at the same time, you should also remember that main server serves your website for the end users and these parallel downloads can affect the overall speed of your main server.

     

    Conversion phase 2

    During phase 2 conversion servers will download video source from main server (if this option enabled in their settings, see the previous section) and will do all the necessary conversion logic programmed. Here each conversion server works independently of everything else. If you have 10 conversion servers, they will do phase 2 for 10 tasks in parallel, so phase 2 can be easily scaled to any speed you want by just adding more conversion servers.

    It is a common practice to create multiple conversion servers (at least 2) for the same physical server. You can easily do that by simply using separate conversion folders, so you can create 2 or more conversion servers in KVS using the same physical server box, e.g.:

    Convertor 1.2.3.4 - 1: /home/ftpuser/conversion1

    Convertor 1.2.3.4 - 2: /home/ftpuser/conversion2

    Convertor 1.2.3.4 - 3: /home/ftpuser/conversion3

    Why does this make sense? The whole phase 2 conversion consists of multiple conversion steps, here are some examples of them:

    • Downloading source file from the main server
    • Using ffmpeg to convert video to another format or quality
    • Using ffmpeg to take screenshots from video
    • Using imagemagick to create thumbs for the screenshots
    • Copying result video files to storage server(s)

    If you look at these steps, some of them are using much CPU and some of them are using much network to download or upload. Also when taking screenshots from video files ffmpeg is using less CPU in comparison to when converting, taking screenshots can result in some delays depending on source file and how easily it can be navigated based on keyframes.

    If you use only 1 conversion server for 1 physical server, there will be intervals when your CPU load is 0% or when your network load is 0%. This is a waste of resources. By creating at least 2 conversion servers for the same physical server you will increase its conversion speed and overall resources utilization will be close to 100%. But this doesn't mean that adding more conversion servers here will increase the speed to x2, or x3 - this is just a matter of +20% or +30%. Therefore we think that having 2 or max 3 conversion servers per 1 physical server is more than enough.

     

    Conversion phase 3

    This final phase is executed back again on the main server. When conversion server finishes processing a task, main conversion engine will pull this task result from conversion server. All high-CPU operations have already been done on conversion server and this phase is just to pull result screenshots and result video files if needed. Copying files may take time, especially on low quality network connections. This phase is like phase 1 in term of time - it can take much time to copy big or many files and the number of conversion servers you have cannot speed this up.

    Similar to what we said in phase 1, phase 3 can also have optimized copying. Each conversion server has an option to enable it to copy video files to storage servers and thus main server will not have to do that:

    conversion_copy_target_files.png.c3bdb3821eea493aef2a0837b77e09fc.png

    This will result in parallel video files copying and you can benefit here from having multiple conversion servers.

    There is one case however, when this option cannot be used - if you have a local storage server. The reason is that local storage server is defined as a directory path (e.g. /var/www/domain.com/contents/videos), and this directory makes sense for the main server only. Remote conversion servers cannot use this path, so they won't be able to copy result video files. In such cases KVS will automatically disable this option and will force all result video files to be copied via main server. Then you have no much sense to add many remote conversion servers, since they will probably have a lot of spare resources.

     

    Summary: what can affect conversion speed

    Here is a summary of factors that can affect conversion speed in different scenarios:

    1. Connection latency / network speed between main server and conversion servers - bad network conditions will reduce conversion speed, that's why remote conversion servers should be located ideally with the same datacenter to avoid network roundtrips.
    2. CPU and disk speed on conversion servers - converting big video files can utilize much CPU (when scaling, watermarking) and also disk subsystem. Very slow disks may result in CPU resources not fully utilized. RAM is not very significant, however we've seen some cases when ffmpeg or imagemagick was using more than 1GB of RAM. For a conversion server you should have at least 2GB of free RAM. If you use multiple conversion servers on the same physical server, then your physical server should have 2GB * number of conversion servers you plan there.
    3. In multiple remote conversion servers scenario if servers are allowed to download source files from main server, it is critically important that main server is able to serve all these files in parallel as well as it is able to serve your end users at the same time. Otherwise the benefit from using multiple conversion servers will be only in reducing CPU usage on the main server and not speeding up conversion process much.
    4. If you have any local storage server, which is used to host newly uploaded videos, then you will not get 100% benefit from using multiple remote conversion servers, as main server will have to pull all result video files from them in 1 thread, which will mean that your overall system conversion speed will be limited to the speed of pulling an average video file from a remote conversion server. You can still use 1 or 2 remote conversion servers for reducing main server's CPU usage.
    5. When uploading video files without conversion (e.g. you upload them not as source files, but as ready video formats, which is very popular when using tube scrapper plugin), CPU resources are mostly not being used. Thus in such scenarios the key component to speeding up new content processing is reducing network utilization. No much sense to use remote conversion servers, since no much CPU resources are being utilized. Instead remote conversion servers will increase network utilization and thus may reduce overall speed. If you are using local storage - you are fine with 1 local conversion server. But if you are using remote storage, you may need to add 1 more local conversion server (with another directory on filesystem), to parallel the process of copying video files to storage server(s) and thus to increase processing speed.

     

    How to analyze performance

    You can find conversion logs in Administration -> Background tasks log section:

    conversion_task_details.png.05c00ca52040f845e404a3d63178380b.png

    By looking into these stats you can have some understanding of what is the problem, if you have one. If most of the time is spent on creating video files, it may indicate that your CPU is quite slow. If much time is spent on copying or downloading files, it may indicate that your network connection is poor, or network is overloaded at some port (main, conversion or storage server), or disks are overloaded.

    Please pay attention to "Waiting for xxx to start phase Y" messages. They do not mean that conversion engine is stuck and "actively waiting", absolutely no - conversion engine may switch to another task during this period, which is the most likely scenario when you have many tasks. These waiting timings may be big enough, up to hours, but they are not considered when calculating "effective" time spent on task processing.

     

    Transcoding performance

    In most cases when you upload videos into KVS (not using embed codes or hotlinking 3rd-party video files) and your external storage / conversion servers do not have network bottlenecks, the major time is being spent on video transcoding. This is what background task log details names as "Creating format file". The transcoding is the process of decoding video file, resizing it to another size and compressing it back. This process uses a lot of CPU resources, and in some cases when your videos are in Full HD / 4K quality it may also utilize HDD due to big size of source and target files.

    Transcoding in KVS is typically used to create different resolutions of the same video, so that users can watch video in different qualities. Another reason of using video transcoding is to add watermark(s) on top of it. If transcoding takes much time in your setup and you are not happy with the number of videos that are being processed during each day, then there are few options to increase transcoding speed:

    1) Add more external conversion servers so that more videos can be processed at once in parallel (possible with KVS Ultimate only). This is the most obvious, and the most expensive option. You need to buy some more server(s) for the time that you need to transcode your videos.

    2) Use GPU-powered server and configure GPU conversion. GPUs are working faster on video transcoding due to various technical reasons, however the main issue with them is that you need vendor-specific ffmpeg codecs that will support transcoding on GPU. These codecs are never part of standard ffmpeg distributions (ffmpeg is the server library that does video transcoding), and they need to be built manually by your server support. Another problem is that you should change ffmpeg options in video format settings in KVS admin panel to get these video codecs working.

    3) Avoid using transcoding and upload already prepared (transcoded) video files. This approach is typically used with grabbers and importing feeds, when the videos that you need to import are already transcoded into multiple qualities. All that KVS needs to do is to download them and put into storage system. No transcoding will happen in this case, so no CPU / GPU power is needed. However, your video files must be already present in all qualities you want to support, and also you will not be able to put any watermarks on them. You can find out more about uploading already transcoded video files in this article:


    If you are using grabbers, then check this article about speeding up grabbing:

     

    4) Finally, if none of the above options works for you (you don't want to pay for conversion servers, or you are not using grabbers and don't have video transcoded in different video qualities), then the only way to avoid transcoding or reduce its time is to reduce the number of video qualities that your site offers. You can find them in Settings -> Video formats section of admin panel. By default KVS typically installs the following qualities:

    • MP4 480p (the lowest and required)
    • MP4 720p (for videos 720p+)
    • MP4 1080p (for videos 1080p+)
    • MP4 4K (for videos 4K+)

    For each of these video formats you can see the number of videos that have it. This can let you identify, if you win much time if you decide to stop using MP4 4K or MP4 1080p qualities for example. Are there many videos that have them in % to your videos that have MP4 480p? If yes, then you can increase transcoding speed in several times by simply disabling these formats. If most of your videos are 480p and 720p, then you won't win much from disabling them and have to do another choice:

    • Delete 720p quality and keep all your videos in 480p. This would result in low visual quality and could become problem for your site in general. Actually 480p quality is too small for modern devices.
    • Delete 720p quality and change 480p resize option to Do not resize (keep source size). This would result in each video will have the same quality as originally uploaded source file. No quality change will be possible, and all users will see video in the same quality. This could be good option, but you should keep in mind that if some of your source files are 1080p or 4k, they will be transcoded with the same size, and could take much disk space on your storage and utilize much network when somebody is watching them. So this option is good when you know for sure most of your source video files are of 720p / 480p quality; or you are OK with the fact that many videos will be served in 1080p+ quality from your servers. Also this option allows you completely avoid transcoding by uploading your source video not in Source file field, but in 480p format field (or better rename it to some other name to avoid confusion).
    • Make 720p quality required (WARNING! this will create a set of tasks to create 720p for all videos that don't have it), and after it is created for all videos, delete 480p quality. So all your videos will be transcoded into 720p format only. If the source file is bigger than 720p (e.g. 1080p or 4K), its quality will be reduced to 720p; and if the source file is initially smaller - the quality will remain the same as source. This option is a good choice, when you want to serve decent video quality to your users, and you know that your source files have many of 1080p+, and you don't want to serve 1080p quality to all users.

     

  2. Here is sample code for album grabber:

    <?php
    
    class KvsGrabberAlbumCustomSample extends KvsGrabberAlbum
    {
       public function get_grabber_id()
       {
           return "albums_custom_sample";
       }
    
       public function get_grabber_name()
       {
           return "Sample custom grabber";
       }
    
       public function get_grabber_version()
       {
           return "1";
       }
    
       public function get_grabber_domain()
       {
           return "domain1.com";
       }
    
       public function get_supported_url_patterns()
       {
           return array("/https?:\/\/(www\.)?domain1\.com\/.*/i");
       }
    
       public function can_grab_description()
       {
           return true;
       }
    
       public function can_grab_categories()
       {
           return true;
       }
    
       public function can_grab_tags()
       {
           return true;
       }
    
       public function can_grab_models()
       {
           return true;
       }
    
       public function can_grab_content_source()
       {
           return true;
       }
    
       public function can_grab_rating()
       {
           return true;
       }
    
       public function can_grab_views()
       {
           return true;
       }
    
       public function can_grab_date()
       {
           return true;
       }
    
       public function can_grab_lists()
       {
           return true;
       }
    
       public function grab_list($list_url, $limit)
       {
           $result = new KvsGrabberListResult();
           $result->add_content_page("http://domain1.com/album1/");
           $result->add_content_page("http://domain1.com/album2/");
           return $result;
       }
    
       protected function grab_album_data_impl($page_url, $tmp_dir)
       {
           $result = new KvsGrabberAlbumInfo();
    
           $page_code = $this->load_page($page_url);
           if (!$page_code)
           {
               $result->log_error(KvsGrabberAlbumInfo::ERROR_CODE_PAGE_UNAVAILABLE, "Page can't be loaded: $page_url");
               return $result;
           }
    
           $result->set_canonical($page_url);
           $result->set_title("Demo title");
           $result->set_description("Demo description long description long description long description long description.");
           $result->set_date(time());
    
           $result->set_views(1526);
           $result->set_rating(87); //0-100%
           $result->set_votes(11);
    
           $result->add_category("Category 1");
           $result->add_category("Category 2");
           $result->add_category("Category 3");
    
           $result->add_tag("tag 1");
           $result->add_tag("tag 2");
           $result->add_tag("tag 3");
    
           $result->add_model("Model 1");
           $result->add_model("Model 2");
           $result->add_model("Model 3");
    
           $result->set_content_source("Content Source 1");
    
           $result->add_image_file("http://www.domain1.com/test/test.jpg?v=1");
           $result->add_image_file("http://www.domain1.com/test/test.jpg?v=2");
    
           return $result;
       }
    }
    
    $grabber = new KvsGrabberAlbumCustomSample();
    KvsGrabberFactory::register_grabber_class(get_class($grabber));
    return $grabber;
     
  3. In video / album editor under categorization settings we added ability to run category / tag /model autoselection plugins for individual videos on their editing.

    This can be useful if your content writers process videos before activation and you have some categorization set to be auto-selected from title / description / tags:

    run_categorizaton_plugins.png.9dea7f202e370be749201d95c5d5f2ea.png

  4. For storage servers we added sync option, which will allow to sync content on one server based on content on other servers from the same group.

     

    This is needed in 2 cases:

    1) When you want to move all content to a new server, you add a new server into the same storage group and previously you had to manually copy all content to a new server, before it can be activated.

    2) When you want to load balance the same content between multiple servers.

     

    Now we added a sync option and you won't need to copy anything manually. When you add a new storage server into the existing group, you can use this option to start syncing content on this server:

     

    servers_sync_option.png.be295c6faa8c8809ca1c9792d47515ae.png

     

    This will create low priority background task, which will sync all content using iterations limited to max 100 objects (videos or albums) per iteration. Since this task may take long time (days and even weeks to copy all content between servers), the iterative approach will ensure that your conversion queue won't be frozen for the long period:

     

    servers_sync_task.png.2b53a978a67f5710ccf81833fbd655c7.png

    • Like 1
  5. In videos massedit we changed the way how video format can be created or deleted. Previously it was only possible to create / delete 1 format at a time.

     

    Now it will be possible to create / delete multiple formats with the same massedit operation:

    mass_edit_formats.png.724ce3153b4644d32a1ca016a19fb731.png

     

    Also it will now be possible to change Access level field via massedit for both videos and albums.

  6.  

    And what I say it would be nice to have an option that says "copy this video to server X"

     

     

    OK, I get your point! We may need to create "sync content" option which can be executed manually when needed and it will verify all content at the given server and if some content is missing (which is true for ALL content in your case) it will sync this missing content from any other servers of this group. So that you don't need to do that manually with SSH.

     

    Well, probably this is doable.

  7. In 3.9.2 we continue advertising enhancements with some important player advertising improvements.

     

    First of all it will now be possible to connect all HTML ads (start screen, pre-roll, post-roll and on-pause screen) to a site advertising spot:

     

    player_ad_spot.png.59cc5a97b478415e9c4fa39eaed72630.png

     

    This will not simply allow you to rotate ads in player, but with the bunch of other advertising features we've added into 3.9.2 this will allow ULTIMATE control on what and where is displayed in player HTML ads:

    - you can now show separate player ads for desktop and mobile users

    - you can disable specific ads for phone users where screens are too small to show ads

    - you can easily disable ads for premium / registered users in just few clicks

    - you can show specific ads for specific countries

    - you can show specific ads for specific video categories

    - you can control the exact date and time when specific ads will be displayed

     

    Here is an example configuration of Player start advertising spot, which basically has 2 ads: one for desktop and tablet users and another for phones:

     

    player_ad_spot_example.png.31af8f8f180724948343673a2de2cd49.png

     

    And also for pre-roll ads (advertising which plays some time before the actual video starts) it will now be possible to configure how often it will be repeated. It may be annoying to show this ad for every video, so player settings will allow to reduce the frequency of this advertising by specifying how many videos should be skipped before the next pre-roll repeat:

     

    player_pre_roll_repeat.png.13e97896ad1aed571daeb3915ad1d056.png

  8.  

    It is not necessary but it can be very productive, I for example configuere it and I do everything manually, for example when my site has 90 people online I send a notification and they get to connect more than 200, then if this could be done automatically by every video would be great.

     

     

    I think you don't need anything in KVS to be able to use it. They should provide some kind of JS code that you can add into footer or header template and it will automatically load all necessary functionality.

     

    Another thing I would like to have KVS is that if I install a new server for storage I can copy everything from one server to another and create a copy of the exact data.

     

    This is not a good idea. Many customers do not understand completely how KVS storage system works, they are trying to add servers in whatever way they think and this is not necessary the correct way. Right now automatic copying doesn't happen, so it is always possible to fix easily if something is not correctly configured and redo the configuration. If adding new server triggers automatic content copying for 100s GB of existing content, this operation will not be easily undone and somebody may even not notice it.

     

    Therefore we think that adding automation here will cause more issues, than benefits.

    The situation when you need to manually copy content is rare, it is only needed when you want to load balance content between multiple servers (e.g. 1 or 2 times in a life). While the more common case is when you want to extend storage space to store new content and this doesn't require any automatic copying.

  9. Unfortunately we will not be able to finish all planned emailing changes in 3.9.2, they will be postponed to 3.9.3. We are planning to implement at least ability to configure emails via 3rd-party mail servers, which is the highly demanded feature.

     

    As for your question, we planned that user should be able to configure email templates in admin panel, e.g. specify their HTML code like currently for page templates. Their design and appearance should be of cause designed by someone.

     

    You can actually modify email templates right now in KVS, but not from admin panel.

  10. We added ability to minify HTML code generated by KVS on the fly, however we decided not to add this option into admin panel.

     

    The reason is that this is mostly needed for "geeks", it can produce some issues for other users if enabled. Here is what we've noticed:

     

    1) If users provide multi-line descriptions when uploading videos or albums, they will be reset to single-line if this video or album is edited in site area again, since multi-line text will not be supported in textareas anymore.

     

    2) If using custom JS or CSS inline code, the lines which are not terminated correctly will produce browser errors and will stop working. Consider this example:

     

    <style>
    .test {
    display: none
    color: black
    }
    </style>
    

     

    This CSS will not work, since there are no semicolons at the end of each statement. Same with JS code, but may also break other valid JS code on the page.

     

    If you would like to enable this, you can add this option into /admin/include/setup.php file (or change to true, if it exists already):

    $config['minify_html']="true";
    

  11. Added support for paid subscriptions inside KVS for users and channels by using tokens. This functionality utilizes the same subscription model, as was used before (ability to subscribe models, users, content sources and channels). However for users and channels it will now be possible to enable paid subscription, so that users can only subscribe them if they have enough tokens on their balance. The settings are located in Settings -> Memberzone settings area, which were also regrouped for clear understanding.

     

    In settings it is possible to define default price in tokens (can be 0, which means that they do not require tokens by default) and period of subscription. Individual users and channels can override the default price in their settings.

     

    paid_subscriptions.png.53accfd3b115296db02fae98f5b254eb.png

     

     

    When subscribing a user or channel that requires payment, user will spend the needed amount of tokens and will get PREMIUM access level to all videos / albums that are owned by this channel or user for the configured period of time. When the period ends, KVS will try to extend subscription if this user has enough tokens. If not, subscription will be expired and user will no longer have PREMIUM access to this content.

     

    All such purchases are shown in purchase stats in admin panel. The example picture shows several subscription purchases rebilled by KVS every 24 hours:

    subscriptions_purchases.png.5ec2b0d3ee14483cc3aca7c52d97289e.png

     

    Then it is also possible to enable users to earn 100% or less tokens from the subscriptions they sell. Users can either sell their profile as a whole, or their created channels separately. Users cannot specify subscription period, but they can specify price in tokens they want to get.

     

    In order to activate that in themes, it will be needed to adjust template codes for member_profile_edit / dvd_edit blocks to allow user specify tokens. Here is example template code for default theme, that will work in both blocks and will render a textfield to enter tokens price either for the whole profile (if put into member_profile_edit) or for individual channels (if put into dvd_edit):

     

    {{if $allow_tokens==1}}
    <div class="row">
    <label for="edit_profile_tokens_required" class="field-label">Tokens required for {{$tokens_period_default}} days</label>
    <input type="text" name="tokens_required" id="edit_profile_tokens_required" class="textfield" value="{{if $smarty.post.tokens_required>0}}{{$smarty.post.tokens_required}}{{/if}}" placeholder="default price {{$tokens_price_default}} with commission {{$tokens_commission}}%"/>
    <div class="field-error down"></div>
    </div>
    {{/if}}
    

     

    Then if settings allow users to earn tokens from selling subscriptions to their profiles or channels, they will get awards with each subscription and rebill. The sum of award depends on subscription price and your commission configured in memberzone settings:

     

    subscriptions_awards.png.1bfcdd50d33d493e3fe153441b962c0c.png

     

    Finally if users want to cancel their rebills on specific subscriptions, they can unsubscribe using existing way (either on user / channel page, or in the list of their subscriptions). They will still have PREMIUM access until the period will end, then their subscription will not be rebilled.

     

    Within this new functionality we also updated several blocks to display the needed data:

     

    - list_members_subscriptions: mode_purchased parameter was added to display list of active subscriptions that were paid. In this mode it will be possible to display expiry date {{$item.expiry_date}}, whether the subscription was cancelled {{if $item.is_cancelled==1}}cancelled{{else}}active{{/if}} and also tokens required for every rebill {{$item.tokens}}.

     

    - list_members_tokens: added 2 types of awards {{if $item.flow_type=='award_user_sale'}}subscription sold{{elseif $item.flow_type=='award_dvd_sale'}}channel subscription sold{{/if}} and 2 types of purchases {{if $item.flow_type=='purchase_dvd'}}channel purchase{{elseif $item.flow_type=='purchase_user'}}user purchase{{/if}}.

     

    - dvd_view, member_profile_view: added ability to display price for this channel / user in tokens {{$data.tokens_required}} and period of subscription in days {{$data.tokens_required_period}}. If you want to separate free channels /users from paid channels / users, you should compare price with 0: {{if $data.tokens_requred==0}}free{{else}}paid{{/if}}.

     

    - dvd_edit, member_profile_edit: exposed variable to check if it is possible to earn tokens from selling channels / users {{if $allow_tokens==1}}user can specify price{{/if}}, show default price {{$tokens_price_default}}, show subscription period configured in settings {{$tokens_period_default}} and show your site commission rate in percents {{$tokens_commission}}.

    • Like 1
  12. # global ---------------------------------------------------------------------------------------------------------------
    
    rewrite ^/terms/$   /terms.php last;
    rewrite ^/dmca/$    /dmca.php last;
    rewrite ^/2257/$    /2257.php last;
    rewrite ^/privacy/$ /privacy.php last;
    
    rewrite ^/random_video(/)?$ /redirect_random_video.php last;
    rewrite ^/random_album(/)?$ /redirect_random_album.php last;
    
    rewrite ^/rss/videos/$                    /rss_videos.php last;
    rewrite ^/rss/albums/$                    /rss_albums.php last;
    rewrite ^/rss/tags/([^/]+)/videos/$       /rss_videos.php?tag=$1 last;
    rewrite ^/rss/tags/([^/]+)/albums/$       /rss_albums.php?tag=$1 last;
    rewrite ^/rss/categories/([^/]+)/videos/$ /rss_videos.php?category=$1 last;
    rewrite ^/rss/categories/([^/]+)/albums/$ /rss_albums.php?category=$1 last;
    rewrite ^/rss/models/([^/]+)/videos/$     /rss_videos.php?model=$1 last;
    rewrite ^/rss/models/([^/]+)/albums/$     /rss_albums.php?model=$1 last;
    
    # search ---------------------------------------------------------------------------------------------------------------
    
    rewrite ^/search/([^/]+)/albums/([0-9]+)/$ /albums_list.php?q=$1&from=$2 last;
    rewrite ^/search/([^/]+)/albums/$          /albums_list.php?q=$1 last;
    rewrite ^/search/([^/]+)/models/([0-9]+)/$ /models_list.php?q=$1&from=$2 last;
    rewrite ^/search/([^/]+)/models/$          /models_list.php?q=$1 last;
    rewrite ^/search/([^/]+)/([0-9]+)/$        /videos_list.php?q=$1&from=$2 last;
    rewrite ^/search/([^/]+)/$                 /videos_list.php?q=$1 last;
    rewrite ^/search/$                         /videos_list.php last;
    
    # videos ---------------------------------------------------------------------------------------------------------------
    
    rewrite ^/videos/([0-9]+)/$ /videos_list.php?from=$1 last;
    rewrite ^/videos/$          /videos_list.php last;
    
    rewrite ^/videos/([0-9]+)/([^/]+)/$ /view_video.php?id=$1&dir=$2 last;
    rewrite ^/videos/([^/]+)/$          /view_video.php?dir=$1 last;
    
    # albums ---------------------------------------------------------------------------------------------------------------
    
    rewrite ^/albums/([0-9]+)/$ /albums_list.php?from=$1 last;
    rewrite ^/albums/$          /albums_list.php last;
    
    rewrite ^/albums/([0-9]+)/([^/]+)/$ /view_album.php?id=$1&dir=$2 last;
    rewrite ^/albums/([^/]+)/$          /view_album.php?dir=$1 last;
    
    # playlists ------------------------------------------------------------------------------------------------------------
    
    rewrite ^/playlists/([0-9]+)/([^/]+)/$ /view_playlist.php?id=$1&type=fav_videos&ipp=30&playlist_id=$1 last;
    
    # tags ---------------------------------------------------------------------------------------------------------------
    
    rewrite ^/tags/([^/]+)/([0-9]+)/$        /content_list.php?tag=$1&from=$2 last;
    rewrite ^/tags/([^/]+)/$                 /content_list.php?tag=$1 last;
    rewrite ^/tags/([^/]+)/videos/([0-9]+)/$ /videos_list.php?tag=$1&from=$2 last;
    rewrite ^/tags/([^/]+)/videos/$          /videos_list.php?tag=$1 last;
    rewrite ^/tags/([^/]+)/albums/([0-9]+)/$ /albums_list.php?tag=$1&from=$2 last;
    rewrite ^/tags/([^/]+)/albums/$          /albums_list.php?tag=$1 last;
    
    # categories  ----------------------------------------------------------------------------------------------------------
    
    rewrite ^/categories/([0-9]+)/$ /categories_list.php?from=$1 last;
    rewrite ^/categories/$          /categories_list.php last;
    
    rewrite ^/categories/([^/]+)/([0-9]+)/$        /content_list.php?category=$1&from=$2 last;
    rewrite ^/categories/([^/]+)/$                 /content_list.php?category=$1 last;
    rewrite ^/categories/([^/]+)/videos/([0-9]+)/$ /videos_list.php?category=$1&from=$2 last;
    rewrite ^/categories/([^/]+)/videos/$          /videos_list.php?category=$1 last;
    rewrite ^/categories/([^/]+)/albums/([0-9]+)/$ /albums_list.php?category=$1&from=$2 last;
    rewrite ^/categories/([^/]+)/albums/$          /albums_list.php?category=$1 last;
    
    # models  --------------------------------------------------------------------------------------------------------------
    
    rewrite ^/models/([0-9]+)/$        /models_list.php?from=$1 last;
    rewrite ^/models/$                 /models_list.php last;
    rewrite ^/models/([^/])/([0-9]+)/$ /models_list.php?section=$1&from=$2 last;
    rewrite ^/models/([^/])/$          /models_list.php?section=$1 last;
    
    rewrite ^/models/([^/]+)/([0-9]+)/$        /content_list.php?model=$1&from=$2 last;
    rewrite ^/models/([^/]+)/$                 /content_list.php?model=$1 last;
    rewrite ^/models/([^/]+)/videos/([0-9]+)/$ /videos_list.php?model=$1&from=$2 last;
    rewrite ^/models/([^/]+)/videos/$          /videos_list.php?model=$1 last;
    rewrite ^/models/([^/]+)/albums/([0-9]+)/$ /albums_list.php?model=$1&from=$2 last;
    rewrite ^/models/([^/]+)/albums/$          /albums_list.php?model=$1 last;
    
    # memberzone -----------------------------------------------------------------------------------------------------------
    
    rewrite ^/my/$                             /member_profile_view.php last;
    rewrite ^/my/favourites/videos/([0-9]+)/$  /member_profile_view.php?type=fav_videos&from_my_fav_videos=$1 last;
    rewrite ^/my/favourites/videos/$           /member_profile_view.php?type=fav_videos last;
    rewrite ^/my/favourites/albums/([0-9]+)/$  /member_profile_view.php?type=fav_albums&from_my_fav_albums=$1 last;
    rewrite ^/my/favourites/albums/$           /member_profile_view.php?type=fav_albums last;
    rewrite ^/my/favourites/models/([0-9]+)/$  /member_profile_view.php?type=fav_models&from_my_fav_models=$1 last;
    rewrite ^/my/favourites/models/$           /member_profile_view.php?type=fav_models last;
    rewrite ^/my/playlist/([0-9]+)/([0-9]+)/$  /member_profile_view.php?type=fav_videos&playlist_id=$1&from_my_fav_videos=$1 last;
    rewrite ^/my/playlist/([0-9]+)/$           /member_profile_view.php?type=fav_videos&playlist_id=$1 last;
    rewrite ^/my/playlists/([0-9]+)/$          /member_profile_view.php?type=playlists&from_my_playlists=$1 last;
    rewrite ^/my/playlists/$                   /member_profile_view.php?type=playlists last;
    
    rewrite ^/my/playlist/view/([0-9]+)/([0-9]+)/$ /view_video.php?playlist=$1&id=$2 last;
    
    rewrite ^/my/playlists/new/$           /index.php?mode=async&function=get_block&block_id=playlist_edit_edit_playlist_form&global=true last;
    rewrite ^/my/playlists/select/$        /index.php?mode=async&function=get_block&block_id=list_playlists_playlists_selector&global=true last;
    rewrite ^/my/playlists/edit/([0-9]+)/$ /index.php?mode=async&function=get_block&block_id=playlist_edit_edit_playlist_form&global=true&playlist_id=$1 last;
    
    rewrite ^/logout/$   /logout.php last;
    rewrite ^/email/$    /email_links.php last;
    rewrite ^/payments/$ /payment_links.php last;
    
    rewrite ^/login/$            /index.php?mode=async&function=get_block&block_id=logon_logon_form&global=true last;
    rewrite ^/login-required/$   /index.php?mode=async&function=get_block&block_id=signup_signup_form_premium&global=true&error=only_for_members last;
    rewrite ^/signup/$           /index.php?mode=async&function=get_block&block_id=signup_signup_form_premium&global=true last;
    rewrite ^/upgrade/$          /index.php?mode=async&function=get_block&block_id=upgrade_upgrade_access&global=true last;
    rewrite ^/upgrade-required/$ /index.php?mode=async&function=get_block&block_id=upgrade_upgrade_access&global=true&error=only_for_members last;
    rewrite ^/reset-password/$   /index.php?mode=async&function=get_block&block_id=signup_reset_password_form&global=true last;
    rewrite ^/feedback/$         /index.php?mode=async&function=get_block&block_id=feedback_feedback_form&global=true last;
    rewrite ^/captcha/([^/]*)/$  /index.php?mode=async&function=show_security_code&captcha_id=$1 last;
    
    # SYSTEM / DO NOT CHANGE -----------------------------------------------------------------------------------------------
    rewrite ^/sitemap.xml$ /sitemap.php last;
    rewrite ^/embed/(.+)$ /player/iframe_embed.php?video_id=$1 last;
    rewrite ^/related_videos_html/([0-9]+)/?$ /related_videos_html.php?video_id=$1 last;
    rewrite ^/get_file/([0-9]+)/([^/]*)/(.*)$ /get_file.php?sg_id=$1&hash=$2&file=$3 last;
    rewrite ^/get_image/([0-9]+)/([^/]*)/(.*)/$ /get_image.php?sg_id=$1&hash=$2&file=$3 last;
    # END SYSTEM -----------------------------------------------------------------------------------------------------------
    

  13. You don't need to include any dependent libraries, as these libraries already included into the theme JS file.

     

    The code you posted at the very beginning is working if simply copy it to footer, the only thing you need is to add CSS styles to make it be displayed correctly.

×
×
  • Create New...