Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

Commit

Permalink
show size in rss if exists; offer magnet/torrent option
Browse files Browse the repository at this point in the history
  • Loading branch information
boypt committed Jul 27, 2021
1 parent a2d98f3 commit 702bfe8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
6 changes: 6 additions & 0 deletions server/server_rss.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ type rssJSONItem struct {
Published string `json:"published"`
URL string `json:"url"`
Torrent string `json:"torrent"`
Size string `json:"size"`
publishedParsed *time.Time
}

Expand Down Expand Up @@ -73,6 +74,11 @@ func (r *rssJSONItem) readExtention(i *gofeed.Item, ext string) (found bool) {
// There are no starndards for rss feeds contains torrents or magnets
// Heres some sites putting info in the extentions
if etor, ok := i.Extensions[ext]; ok {

if e, ok := etor["size"]; ok && len(e) > 0 {
r.Size = e[0].Value
}

if e, ok := etor["magnetURI"]; ok && len(e) > 0 {
r.Magnet = e[0].Value
found = true
Expand Down
6 changes: 6 additions & 0 deletions static/files/js/omni-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,12 @@ app.controller("OmniController", function (
});
};

$scope.submitTorrentItem = function (result) {
if (result.torrent) {
api.url(result.torrent).then(reqinfo);
}
}

$scope.submitSearchItem = function (result) {
//if search item has magnet/torrent, download now!
if (result.magnet) {
Expand Down
6 changes: 5 additions & 1 deletion static/files/template/omni.html
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,11 @@ <h4 class="ui dividing header">
<span class="peers"> {{ r.peers }}</span>
</td>
<td class="controls">
<i ng-click="submitSearchItem(r)" class="ui green download icon"></i>
<i ng-click="submitSearchItem(r)" class="ui green magnet icon" title="load the magnet link"></i>
</td>
<td ng-if="r.torrent" class="controls">
<i ng-click="submitTorrentItem(r)" class="cloud green download alternate icon"
title="load the .torrent file"></i>
</td>
</tr>
</table>
Expand Down

0 comments on commit 702bfe8

Please sign in to comment.