This repository has been archived by the owner on Oct 19, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bugfix: then torrent_content_hash is not exist
- Loading branch information
Showing
2 changed files
with
46 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,24 @@ | ||
{% load i18n static %} | ||
{% with 'torrent_stream_button_'|add:torrent_content_hash as transport_id %} | ||
{% trans "Watch online" as watch_online_translated %} | ||
<a href="#" id="{{ transport_id }}"> | ||
<img src="{% static "torrent_stream/play_icon_small.png" %}" | ||
alt="{{ watch_online_translated }}" title="{{ watch_online_translated }}" | ||
style="float:left" /> | ||
<span style="padding-left:2px">{{ watch_online_translated }}</span> | ||
</a> | ||
<div style="clear:both"></div> | ||
<script type="text/javascript"> | ||
var torrent_stream_config = { | ||
'transport_id': '{{ transport_id }}', | ||
'torrent_stream_js': '{% url torrent_stream_js torrent_content_hash %}', | ||
'box_width': parseInt('{{ TORRENT_STREAM_PLAYER.width }}'), | ||
'box_height': parseInt('{{ TORRENT_STREAM_PLAYER.height }}'), | ||
'ajax_loader': '{% static "torrent_stream/ajax-loader.gif" %}', | ||
'close_player_confirm': '{% trans "Are you sure you want to close the player?" %}' | ||
} | ||
</script> | ||
<script type="text/javascript" src="{% static "torrent_stream/button.js" %}"></script> | ||
{% endwith %} | ||
{% if torrent_content_hash %} | ||
{% with 'torrent_stream_button_'|add:torrent_content_hash as transport_id %} | ||
{% trans "Watch online" as watch_online_translated %} | ||
<a href="#" id="{{ transport_id }}"> | ||
<img src="{% static "torrent_stream/play_icon_small.png" %}" | ||
alt="{{ watch_online_translated }}" title="{{ watch_online_translated }}" | ||
style="float:left" /> | ||
<span style="padding-left:2px">{{ watch_online_translated }}</span> | ||
</a> | ||
<div style="clear:both"></div> | ||
<script type="text/javascript"> | ||
var torrent_stream_config = { | ||
'transport_id': '{{ transport_id }}', | ||
'torrent_stream_js': '{% url torrent_stream_js torrent_content_hash %}', | ||
'box_width': parseInt('{{ TORRENT_STREAM_PLAYER.width }}'), | ||
'box_height': parseInt('{{ TORRENT_STREAM_PLAYER.height }}'), | ||
'ajax_loader': '{% static "torrent_stream/ajax-loader.gif" %}', | ||
'close_player_confirm': '{% trans "Are you sure you want to close the player?" %}' | ||
} | ||
</script> | ||
<script type="text/javascript" src="{% static "torrent_stream/button.js" %}"></script> | ||
{% endwith %} | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,23 @@ | ||
{% with 'torrent_stream_transport_'|add:torrent_content_hash as transport_id %} | ||
<div id="{{ transport_id }}"></div> | ||
<script type="text/javascript"> | ||
(function() { | ||
var script = document.createElement("script"); | ||
script.type = "text/javascript"; | ||
script.src = "{% url torrent_stream_js torrent_content_hash %}"; | ||
script.async = true; | ||
var transport = document.getElementById('{{ transport_id }}'); | ||
transport.appendChild(script); | ||
var player = document.createElement("div"); | ||
player.style.cssText = 'width:{{ TORRENT_STREAM_PLAYER.width }};'+ | ||
'height:{{ TORRENT_STREAM_PLAYER.height }};' + | ||
'overflow:hidden'; | ||
transport.appendChild(player); | ||
script.addEventListener('load', function () { | ||
tsplayer(player, {width: "{{ TORRENT_STREAM_PLAYER.width }}", height: "{{ TORRENT_STREAM_PLAYER.height }}"}); | ||
}); | ||
})(); | ||
</script> | ||
{% endwith %} | ||
{% if torrent_content_hash %} | ||
{% with 'torrent_stream_transport_'|add:torrent_content_hash as transport_id %} | ||
<div id="{{ transport_id }}"></div> | ||
<script type="text/javascript"> | ||
(function() { | ||
var script = document.createElement("script"); | ||
script.type = "text/javascript"; | ||
script.src = "{% url torrent_stream_js torrent_content_hash %}"; | ||
script.async = true; | ||
var transport = document.getElementById('{{ transport_id }}'); | ||
transport.appendChild(script); | ||
var player = document.createElement("div"); | ||
player.style.cssText = 'width:{{ TORRENT_STREAM_PLAYER.width }};'+ | ||
'height:{{ TORRENT_STREAM_PLAYER.height }};' + | ||
'overflow:hidden'; | ||
transport.appendChild(player); | ||
script.addEventListener('load', function () { | ||
tsplayer(player, {width: "{{ TORRENT_STREAM_PLAYER.width }}", height: "{{ TORRENT_STREAM_PLAYER.height }}"}); | ||
}); | ||
})(); | ||
</script> | ||
{% endwith %} | ||
{% endif %} |