|
|
|
@ -15,6 +15,7 @@ from .show_details_screen import ShowDetailsScreen
|
|
|
|
|
from .pattern_details_screen import PatternDetailsScreen
|
|
|
|
|
|
|
|
|
|
from ffx.track_type import TrackType
|
|
|
|
|
from ffx.track_codec import TrackCodec
|
|
|
|
|
from ffx.model.track import Track
|
|
|
|
|
|
|
|
|
|
from ffx.track_disposition import TrackDisposition
|
|
|
|
@ -36,7 +37,7 @@ class MediaDetailsScreen(Screen):
|
|
|
|
|
|
|
|
|
|
Grid {
|
|
|
|
|
grid-size: 5 8;
|
|
|
|
|
grid-rows: 8 2 2 2 8 2 2 8;
|
|
|
|
|
grid-rows: 8 2 2 2 2 8 2 2 8;
|
|
|
|
|
grid-columns: 25 25 120 10 75;
|
|
|
|
|
height: 100%;
|
|
|
|
|
width: 100%;
|
|
|
|
@ -90,6 +91,10 @@ class MediaDetailsScreen(Screen):
|
|
|
|
|
border: solid green;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.purple {
|
|
|
|
|
tint: purple 40%;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.yellow {
|
|
|
|
|
tint: yellow 40%;
|
|
|
|
|
}
|
|
|
|
@ -137,7 +142,25 @@ class MediaDetailsScreen(Screen):
|
|
|
|
|
self.loadProperties()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def getRowIndexFromShowId(self, showId : int) -> int:
|
|
|
|
|
def removeShow(self, showId : int = -1):
|
|
|
|
|
"""Remove show entry from DataTable.
|
|
|
|
|
Removes the <New show> entry if showId is not set"""
|
|
|
|
|
|
|
|
|
|
for rowKey, row in self.showsTable.rows.items(): # dict[RowKey, Row]
|
|
|
|
|
|
|
|
|
|
rowData = self.showsTable.get_row(rowKey)
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
if (showId == -1 and rowData[0] == ' '
|
|
|
|
|
or showId == int(rowData[0])):
|
|
|
|
|
self.showsTable.remove_row(rowKey)
|
|
|
|
|
return
|
|
|
|
|
except:
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def getRowIndexFromShowId(self, showId : int = -1) -> int:
|
|
|
|
|
"""Find the index of the row where the value in the specified column matches the target_value."""
|
|
|
|
|
|
|
|
|
|
for rowKey, row in self.showsTable.rows.items(): # dict[RowKey, Row]
|
|
|
|
@ -145,7 +168,8 @@ class MediaDetailsScreen(Screen):
|
|
|
|
|
rowData = self.showsTable.get_row(rowKey)
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
if showId == int(rowData[0]):
|
|
|
|
|
if ((showId == -1 and rowData[0] == ' ')
|
|
|
|
|
or showId == int(rowData[0])):
|
|
|
|
|
return int(self.showsTable.get_row_index(rowKey))
|
|
|
|
|
except:
|
|
|
|
|
continue
|
|
|
|
@ -376,35 +400,38 @@ class MediaDetailsScreen(Screen):
|
|
|
|
|
yield self.showsTable
|
|
|
|
|
yield Static(" ")
|
|
|
|
|
yield self.differencesTable
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 2
|
|
|
|
|
yield Static(" ", classes="four")
|
|
|
|
|
|
|
|
|
|
# 3
|
|
|
|
|
yield Static(" ")
|
|
|
|
|
yield Button("Substitute", id="pattern_button")
|
|
|
|
|
yield Static(" ", classes="two")
|
|
|
|
|
|
|
|
|
|
# 3
|
|
|
|
|
# 4
|
|
|
|
|
yield Static("Pattern")
|
|
|
|
|
yield Input(type="text", id='pattern_input', classes="two")
|
|
|
|
|
|
|
|
|
|
yield Static(" ")
|
|
|
|
|
|
|
|
|
|
# 4
|
|
|
|
|
# 5
|
|
|
|
|
yield Static(" ", classes="four")
|
|
|
|
|
|
|
|
|
|
# 5
|
|
|
|
|
# 6
|
|
|
|
|
yield Static("Media Tags")
|
|
|
|
|
yield self.mediaTagsTable
|
|
|
|
|
yield Static(" ")
|
|
|
|
|
|
|
|
|
|
# 6
|
|
|
|
|
# 7
|
|
|
|
|
yield Static(" ", classes="four")
|
|
|
|
|
|
|
|
|
|
# 7
|
|
|
|
|
# 8
|
|
|
|
|
yield Static(" ")
|
|
|
|
|
yield Button("Set Default", id="select_default_button")
|
|
|
|
|
yield Button("Set Forced", id="select_forced_button")
|
|
|
|
|
yield Static(" ")
|
|
|
|
|
# 8
|
|
|
|
|
# 9
|
|
|
|
|
yield Static("Streams")
|
|
|
|
|
yield self.tracksTable
|
|
|
|
|
yield Static(" ")
|
|
|
|
@ -462,7 +489,7 @@ class MediaDetailsScreen(Screen):
|
|
|
|
|
kwargs[TrackDescriptor.INDEX_KEY] = int(selected_track_data[0])
|
|
|
|
|
kwargs[TrackDescriptor.TRACK_TYPE_KEY] = TrackType.fromLabel(selected_track_data[1])
|
|
|
|
|
kwargs[TrackDescriptor.SUB_INDEX_KEY] = int(selected_track_data[2])
|
|
|
|
|
kwargs[TrackDescriptor.CODEC_NAME_KEY] = int(selected_track_data[3])
|
|
|
|
|
kwargs[TrackDescriptor.CODEC_KEY] = TrackCodec.fromLabel(selected_track_data[3])
|
|
|
|
|
kwargs[TrackDescriptor.AUDIO_LAYOUT_KEY] = AudioLayout.fromLabel(selected_track_data[4])
|
|
|
|
|
|
|
|
|
|
return TrackDescriptor(**kwargs)
|
|
|
|
@ -473,11 +500,10 @@ class MediaDetailsScreen(Screen):
|
|
|
|
|
return None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def getSelectedShowDescriptor(self):
|
|
|
|
|
|
|
|
|
|
def getSelectedShowDescriptor(self) -> ShowDescriptor:
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
# Fetch the currently selected row when 'Enter' is pressed
|
|
|
|
|
#selected_row_index = self.table.cursor_row
|
|
|
|
|
|
|
|
|
|
row_key, col_key = self.showsTable.coordinate_to_cell_key(self.showsTable.cursor_coordinate)
|
|
|
|
|
|
|
|
|
|
if row_key is not None:
|
|
|
|
@ -501,13 +527,20 @@ class MediaDetailsScreen(Screen):
|
|
|
|
|
|
|
|
|
|
def handle_new_pattern(self, showDescriptor: ShowDescriptor):
|
|
|
|
|
|
|
|
|
|
show = (showDescriptor.getId(), showDescriptor.getName(), showDescriptor.getYear())
|
|
|
|
|
self.showsTable.add_row(*map(str, show))
|
|
|
|
|
if type(showDescriptor) is not ShowDescriptor:
|
|
|
|
|
raise TypeError("MediaDetailsScreen.handle_new_pattern(): Argument 'showDescriptor' has to be of type ShowDescriptor")
|
|
|
|
|
|
|
|
|
|
showRowIndex = self.getRowIndexFromShowId(showDescriptor.getId())
|
|
|
|
|
if showRowIndex is None:
|
|
|
|
|
show = (showDescriptor.getId(), showDescriptor.getName(), showDescriptor.getYear())
|
|
|
|
|
self.showsTable.add_row(*map(str, show))
|
|
|
|
|
|
|
|
|
|
showRowIndex = self.getRowIndexFromShowId(showDescriptor.getId())
|
|
|
|
|
if showRowIndex is not None:
|
|
|
|
|
self.showsTable.move_cursor(row=showRowIndex)
|
|
|
|
|
|
|
|
|
|
self.removeShow()
|
|
|
|
|
|
|
|
|
|
patternDescriptor = self.getPatternDescriptorFromInput()
|
|
|
|
|
|
|
|
|
|
if patternDescriptor:
|
|
|
|
@ -524,10 +557,11 @@ class MediaDetailsScreen(Screen):
|
|
|
|
|
|
|
|
|
|
def action_new_pattern(self):
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
self.__currentMediaDescriptor.checkConfiguration()
|
|
|
|
|
except ValueError:
|
|
|
|
|
return
|
|
|
|
|
#TODO #427: Fehlermeldung in TUI
|
|
|
|
|
# try:
|
|
|
|
|
# self.__currentMediaDescriptor.checkConfiguration()
|
|
|
|
|
# except ValueError:
|
|
|
|
|
# return
|
|
|
|
|
|
|
|
|
|
selectedShowDescriptor = self.getSelectedShowDescriptor()
|
|
|
|
|
|
|
|
|
|