Author Topic: [SOLVED] Protocol handling. Can anyone help with this..?  (Read 1205 times)

0 Members and 1 Guest are viewing this topic.

Offline dmccabe

  • Occasional poster
  • *
  • Posts: 1
    • View Profile
[SOLVED] Protocol handling. Can anyone help with this..?
« on: March 17, 2016, 12:08:01 PM »
Hello everyone

I have been using HFS for a few years now and never run into any problems, or had questions about the usage. (The forums here are awesome!!!)

...until now :P
I am using the simple Media Play template for my Android phone and it works like a charm. Now, I have created a new folder called VR (Virtual Reality) which contains only VR/3D mp4's.

I am looking to 'insert' protocol handling code into the .tpl using the 'Diff template' section under the VR folder properties.

That is, for the files INSIDE this folder only, change the defaut:

<a href="%item-url%">%item-name%</a>  which links to: http://xxx.xxx.xxx.xxx:31027/VR/movie_name.mp4

to something that would link to:

milkvr://sideload/?url=http://xxx.xxx.xxx.xxx:31027/VR/movie_name.mp4

In other words, am looking to prefix the files inside the VR folder with: milkvr://sideload/?url=


I appreciate that this may not be a standard feature for HFS, but was hoping that someone with better knowledge of these things might come to my rescue, or even provide a different option to perform this task.

Thanks all in advance :)
« Last Edit: March 17, 2016, 02:56:49 PM by Mars »

Offline Mars

  • Operator
  • Tireless poster
  • *****
  • Posts: 1876
    • View Profile
Re: Protocol handling. Can anyone help with this..?
« Reply #1 on: March 17, 2016, 02:05:48 PM »
rejoice you  :D
it is not necessary to change HFS, what you ask can be easily done from the template diff

from the default tpl taking as example copy the following sections in the diff tpl
 ---> delete or convert the red text to replace it by  the new blue text

Quote
[file=folder=link|private]
   <tr class='{.if|{.mod|{.count|row.}|2.}|even.}'><td>
        <a href="%item-url%"'><img src="/~img18"></a>
        <input type='checkbox' class='selector' name='selection' value="%item-url%" {.if not|{.or|{.get|can delete.}|{.get|can access.}|{.get|can archive item.}.}|disabled='disabled'.} />
      {.if|{.get|is new.}|<span class='flag'>&nbsp;NEW&nbsp;</span>.}
      {.if not|{.get|can access.}|<img src='/~img_lock'>.}
      <a href="%item-url%" href="{.if|{.=|%item-ext%|mp4.}|{:milkvr://sideload/?url=%item-full-url%:}|{:%item-url%:}.}"><img src="%item-icon%"> %item-name%</a>
      {.if| {.length|{.?search.}.} |{:{.123 if 2|<div class='item-folder'>{.!item folder.} |{.breadcrumbs|{:<a href="%bread-url%">%bread-name%/</a>:}|from={.count substring|/|%folder%.}/breadcrumbs.}|</div>.}:} .}
      {.123 if 2|<div class='comment'>|{.commentNL|%item-comment%.}|</div>.}

[+file]
<td>%item-size%B<td>%item-modified%<td>%item-dl-count%

[+folder]
<td class='nosize'>folder<td>%item-modified%<td>%item-dl-count%

[+link]
<td class='nosize'>link<td colspan='2'>

By doing this, it becomes no longer possible to download the MP4 file, it is just possible to watch it, but by adding the green text. we have again the possibility to save the file  8)

this second example applies only to mp4 files inside folder

Quote
[file=folder=link|private]
   <tr class='{.if|{.mod|{.count|row.}|2.}|even.}'><td>
        <input type='checkbox' class='selector' name='selection' value="%item-url%" {.if not|{.or|{.get|can delete.}|{.get|can access.}|{.get|can archive item.}.}|disabled='disabled'.} />
      {.if|{.get|is new.}|<span class='flag'>&nbsp;NEW&nbsp;</span>.}
      {.if not|{.get|can access.}|<img src='/~img_lock'>.}
      {.if|{.=|%item-ext%|mp4.}|{:
            <a href="%item-url%"><img src="/~img18"></a>
            <a href="milkvr://sideload/?url=%item-full-url%">:}
      |{:<a href="%item-url%">:}.}
      <img src="%item-icon%"> %item-name%</a>

      {.if| {.length|{.?search.}.} |{:{.123 if 2|<div class='item-folder'>{.!item folder.} |{.breadcrumbs|{:<a href="%bread-url%">%bread-name%/</a>:}|from={.count substring|/|%folder%.}/breadcrumbs.}|</div>.}:} .}
      {.123 if 2|<div class='comment'>|{.commentNL|%item-comment%.}|</div>.}

[+file]
<td>%item-size%B<td>%item-modified%<td>%item-dl-count%

[+folder]
<td class='nosize'>folder<td>%item-modified%<td>%item-dl-count%

[+link]
<td class='nosize'>link<td colspan='2'>

« Last Edit: March 17, 2016, 02:34:29 PM by Mars »