Added trailer link, added custom errors, updated keybinding
This commit is contained in:
parent
3d0a714106
commit
43fe513bb1
|
@ -2,6 +2,11 @@
|
|||
<!-- Generated with glade 3.38.2 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.16"/>
|
||||
<object class="GtkImage" id="image1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="stock">gtk-media-play</property>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="scrub_step_adjuster">
|
||||
<property name="lower">1</property>
|
||||
<property name="upper">100</property>
|
||||
|
@ -115,10 +120,22 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="border-width">4</property>
|
||||
<property name="n-rows">2</property>
|
||||
<property name="n-rows">3</property>
|
||||
<property name="n-columns">2</property>
|
||||
<property name="column-spacing">12</property>
|
||||
<property name="row-spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkLinkButton" id="trailer_link">
|
||||
<property name="label" translatable="yes">Trailer</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
<property name="image">image1</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="right-attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
|
@ -126,10 +143,27 @@
|
|||
<property name="label" translatable="yes"><b>File _Name:</b></property>
|
||||
<property name="use-markup">True</property>
|
||||
<property name="use-underline">True</property>
|
||||
<property name="mnemonic-widget">file_name</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top-attach">1</property>
|
||||
<property name="bottom-attach">2</property>
|
||||
<property name="x-options">GTK_FILL</property>
|
||||
<property name="y-options"/>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="label" translatable="yes"><b>_Location:</b></property>
|
||||
<property name="use-markup">True</property>
|
||||
<property name="use-underline">True</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top-attach">2</property>
|
||||
<property name="bottom-attach">3</property>
|
||||
<property name="x-options">GTK_FILL</property>
|
||||
<property name="y-options"/>
|
||||
</packing>
|
||||
|
@ -143,23 +177,8 @@
|
|||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="right-attach">2</property>
|
||||
<property name="y-options"/>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="label" translatable="yes"><b>_Location:</b></property>
|
||||
<property name="use-markup">True</property>
|
||||
<property name="use-underline">True</property>
|
||||
<property name="mnemonic-widget">file_location</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top-attach">1</property>
|
||||
<property name="bottom-attach">2</property>
|
||||
<property name="x-options">GTK_FILL</property>
|
||||
<property name="y-options"/>
|
||||
</packing>
|
||||
</child>
|
||||
|
@ -172,8 +191,8 @@
|
|||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="right-attach">2</property>
|
||||
<property name="top-attach">1</property>
|
||||
<property name="bottom-attach">2</property>
|
||||
<property name="top-attach">2</property>
|
||||
<property name="bottom-attach">3</property>
|
||||
<property name="x-options">GTK_FILL</property>
|
||||
<property name="y-options"/>
|
||||
</packing>
|
||||
|
|
|
@ -37,14 +37,15 @@ class Plugin:
|
|||
self._dialog = None
|
||||
self._thumbnail_preview_img = None
|
||||
self._tmdb = scraper.get_tmdb_scraper()
|
||||
self._state = None
|
||||
self._overview = None
|
||||
self._file_name = None
|
||||
self._file_location = None
|
||||
self._state = None
|
||||
self._trailer_link = None
|
||||
|
||||
self._event_system = None
|
||||
self._event_sleep_time = .5
|
||||
self._event_message = None
|
||||
self._event_system = None
|
||||
self._event_sleep_time = .5
|
||||
self._event_message = None
|
||||
|
||||
|
||||
def get_ui_element(self):
|
||||
|
@ -69,6 +70,7 @@ class Plugin:
|
|||
self._file_location = self._builder.get_object("file_location")
|
||||
self._thumbnail_preview_img = self._builder.get_object("thumbnail_preview_img")
|
||||
self._file_hash = self._builder.get_object("file_hash")
|
||||
self._trailer_link = self._builder.get_object("trailer_link")
|
||||
|
||||
button = Gtk.Button(label=self.name)
|
||||
button.connect("button-release-event", self._show_info_page)
|
||||
|
@ -102,13 +104,14 @@ class Plugin:
|
|||
self._thumbnailer_dialog.hide()
|
||||
|
||||
def _set_ui_data(self):
|
||||
title, path, video_data = self.get_video_data()
|
||||
title, path, trailer, video_data = self.get_video_data()
|
||||
keys = video_data.keys() if video_data else None
|
||||
|
||||
overview_text = video_data["overview"] if video_data else f"...NO {self.name.upper()} DATA..."
|
||||
|
||||
self.set_text_data(title, path, overview_text)
|
||||
self.set_thumbnail(video_data) if video_data else ...
|
||||
self.set_trailer_link(trailer)
|
||||
|
||||
print(video_data["videos"]) if not keys in ("", None) and "videos" in keys else ...
|
||||
|
||||
|
@ -124,15 +127,31 @@ class Plugin:
|
|||
endIndex = _title.index(')')
|
||||
date = title[startIndex:endIndex]
|
||||
except Exception as e:
|
||||
print(repr(e))
|
||||
title = _title
|
||||
date = None
|
||||
|
||||
try:
|
||||
|
||||
video_data = self._tmdb.search(title, date)[0]
|
||||
video_id = video_data["id"]
|
||||
try:
|
||||
results = self._tmdb.tmdbapi.get_movie(str(video_id), append_to_response="videos")["videos"]["results"]
|
||||
for result in results:
|
||||
if "YouTube" in result["site"]:
|
||||
trailer = result["key"]
|
||||
|
||||
if not trailer:
|
||||
raise Exception("No key found. Defering to none...")
|
||||
except Exception as e:
|
||||
print("No trailer found...")
|
||||
trailer = None
|
||||
|
||||
except Exception as e:
|
||||
print(repr(e))
|
||||
video_data = None
|
||||
|
||||
return title, path, video_data
|
||||
return title, path, trailer, video_data
|
||||
|
||||
|
||||
def set_text_data(self, title, path, overview_text):
|
||||
|
@ -164,6 +183,11 @@ class Plugin:
|
|||
else:
|
||||
print('Cover Background Image Couldn\'t be retreived...')
|
||||
|
||||
def set_trailer_link(self, trailer):
|
||||
if trailer:
|
||||
self._trailer_link.set_uri(f"https://www.youtube.com/watch?v={trailer}")
|
||||
|
||||
|
||||
|
||||
|
||||
def wait_for_fm_message(self):
|
||||
|
|
|
@ -10,6 +10,12 @@ from utils.settings import Settings
|
|||
from core.controller import Controller
|
||||
|
||||
|
||||
class App_Launch_Exception(Exception):
|
||||
...
|
||||
|
||||
class Controller_Start_Exceptio(Exception):
|
||||
...
|
||||
|
||||
|
||||
class Application(IPCServer):
|
||||
""" Create Settings and Controller classes. Bind signal to Builder. Inherit from Builtins to bind global methods and classes. """
|
||||
|
@ -32,7 +38,7 @@ class Application(IPCServer):
|
|||
message = f"FILE|{args.new_tab}"
|
||||
self.send_ipc_message(message)
|
||||
|
||||
raise Exception("IPC Server Exists: Will send path(s) to it and close...\nNote: If no fm exists, remove /tmp/solarfm-ipc.sock")
|
||||
raise App_Launch_Exception("IPC Server Exists: Will send path(s) to it and close...\nNote: If no fm exists, remove /tmp/solarfm-ipc.sock")
|
||||
|
||||
|
||||
settings = Settings()
|
||||
|
@ -40,7 +46,7 @@ class Application(IPCServer):
|
|||
|
||||
controller = Controller(args, unknownargs, settings)
|
||||
if not controller:
|
||||
raise Exception("Controller exited and doesn't exist...")
|
||||
raise Controller_Start_Exceptio("Controller exited and doesn't exist...")
|
||||
|
||||
# Gets the methods from the classes and sets to handler.
|
||||
# Then, builder connects to any signals it needs.
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
"<Control>r"],
|
||||
"delete_files" : ["Delete",
|
||||
"<Shift><Control>d"],
|
||||
"tggl_top_main_menubar" : "<Alt>",
|
||||
"tggl_top_main_menubar" : "<Alt>h",
|
||||
"trash_files" : "<Shift><Control>t",
|
||||
"tear_down" : "<Control>q",
|
||||
"go_up" : "<Control>Up",
|
||||
|
|
Loading…
Reference in New Issue