From dafa2cfdf57c4a25ab92e895ccac4eb56c5de625 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Dzi=C4=99giel?= Date: Fri, 9 Apr 2021 18:16:02 +0200 Subject: [PATCH] Fix missing file extension in online URIs --- src/playlist.js | 19 +++++++------------ src/widget.js | 8 ++++---- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/src/playlist.js b/src/playlist.js index c13c525a..59ced052 100644 --- a/src/playlist.js +++ b/src/playlist.js @@ -55,30 +55,25 @@ class ClapperPlaylistWidget extends Gtk.ListBox return true; } + getActiveRow() + { + return this.get_row_at_index(this.activeRowId); + } + getActiveFilename() { - const row = this.get_row_at_index(this.activeRowId); + const row = this.getActiveRow(); if(!row) return null; return row.filename; } - /* FIXME: Remove once/if GstPlay(er) gets - * less vague MediaInfo signals */ - getActiveIsLocalFile() - { - const row = this.get_row_at_index(this.activeRowId); - if(!row) return null; - - return row.isLocalFile; - } - deactivateActiveItem() { if(this.activeRowId < 0) return; - const row = this.get_row_at_index(this.activeRowId); + const row = this.getActiveRow(); if(!row) return null; const icon = row.child.get_first_child(); diff --git a/src/widget.js b/src/widget.js index 0d1672bc..37537981 100644 --- a/src/widget.js +++ b/src/widget.js @@ -316,11 +316,11 @@ class ClapperWidget extends Gtk.Grid title = this.player.customVideoTitle; if(!title) { - const subtitle = this.player.playlistWidget.getActiveFilename(); + const item = this.player.playlistWidget.getActiveRow(); - title = (subtitle.includes('.')) - ? subtitle.split('.').slice(0, -1).join('.') - : subtitle; + title = (item.isLocalFile && item.filename.includes('.')) + ? item.filename.split('.').slice(0, -1).join('.') + : item.filename; } this.root.title = title;