Compare commits
3 Commits
mediaInfoS
...
main
Author | SHA1 | Date | |
---|---|---|---|
7aa26e60d3 | |||
105a8ec077 | |||
b1814e967c |
4
.gitignore
vendored
4
.gitignore
vendored
@ -124,3 +124,7 @@ dmypy.json
|
||||
.pyre/
|
||||
|
||||
TODO
|
||||
|
||||
toBinary
|
||||
|
||||
binary/
|
||||
|
@ -91,9 +91,6 @@ font: 11pt "UbuntuMono NF";</string>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="lineWrapMode">
|
||||
<enum>QTextEdit::NoWrap</enum>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
|
2
mediainfosama/__main__.py
Normal file
2
mediainfosama/__main__.py
Normal file
@ -0,0 +1,2 @@
|
||||
if __name__ == "__main__":
|
||||
import main
|
@ -1,5 +1,4 @@
|
||||
import os, subprocess, json
|
||||
from shlex import quote
|
||||
import os, subprocess
|
||||
|
||||
class FileCmds:
|
||||
def __init__(self, file_path):
|
||||
@ -19,7 +18,7 @@ class FileCmds:
|
||||
:type cmd: str
|
||||
:return: str
|
||||
'''
|
||||
process = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
|
||||
process = subprocess.Popen(cmd, stdout=subprocess.PIPE)
|
||||
output, error = process.communicate()
|
||||
return output
|
||||
|
||||
@ -44,7 +43,7 @@ class FileCmds:
|
||||
:type inform: str
|
||||
:rtype: str
|
||||
'''
|
||||
bash_command = f"mediainfo --Inform={quote(inform)} {quote(self.file_path)}"
|
||||
bash_command = ["mediainfo", f"--Inform={inform}", self.file_path]
|
||||
output = self.execute_bash(bash_command).decode('utf-8')
|
||||
return output
|
||||
|
||||
@ -82,8 +81,8 @@ class FileCmds:
|
||||
'''
|
||||
inform_general = r"General;G: %Format%, %FileSize_String%, %Duration_String%, %BitRate_String%\n"
|
||||
inform_video = r"Video;V: %Format%, %Format_Profile%, %StreamSize_String%, %Width%x%Height%, %FrameRate% FPS, %BitRate_String%\n"
|
||||
inform_audio = r"Audio;A: %Language_String%, %Format%, %StreamSize_String%, %BitRate_String%, %Channel(s)_String%, %SamplingRate_String%\n"
|
||||
inform_text = r"Text;T: %Language_String%, %Format%\n"
|
||||
inform_audio = r"Audio;A: %Language_String%, %Title%, %Format%, %StreamSize_String%, %BitRate_String%, %Channel(s)_String%, %SamplingRate_String%\n"
|
||||
inform_text = r"Text;T: %Language_String%, %Title%, %Format%\n"
|
||||
|
||||
informs = [inform_general]
|
||||
|
||||
@ -105,7 +104,7 @@ class FileCmds:
|
||||
output += "M: Menu\n\n"
|
||||
|
||||
output += "\n"
|
||||
output += self.execute_bash(f"mediainfo {quote(self.file_path)}").decode('utf-8')
|
||||
output += self.execute_bash(["mediainfo", self.file_path]).decode('utf-8')
|
||||
return(output)
|
||||
|
||||
|
||||
@ -115,7 +114,7 @@ class FileCmds:
|
||||
|
||||
:rtype: string
|
||||
'''
|
||||
output = self.execute_bash(f"mediainfo --Full {quote(self.file_path)}").decode('utf-8')
|
||||
output = self.execute_bash(["mediainfo", "--Full", self.file_path]).decode('utf-8')
|
||||
return output
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
from PySide6.QtWidgets import QWidget
|
||||
from PySide6.QtCore import QSize
|
||||
from PySide6.QtGui import QTextCharFormat, QTextCursor, QColor
|
||||
from PySide6.QtGui import QTextCharFormat, QTextCursor, QColor, QTextBlockFormat
|
||||
from ui_main_window import Ui_MainWindow
|
||||
from file_cmds import FileCmds
|
||||
|
||||
@ -62,8 +62,17 @@ class MainWindow(QWidget, Ui_MainWindow):
|
||||
self.content = self.file_cmds.tabs_content[item_selected[0].text()]
|
||||
self.detail_text_edit.setPlainText(self.content)
|
||||
self.search()
|
||||
self.wrap_line_indent()
|
||||
|
||||
|
||||
def wrap_line_indent(self):
|
||||
cursor = QTextCursor(self.detail_text_edit.document())
|
||||
cursor.select(QTextCursor.Document)
|
||||
fmt = QTextBlockFormat()
|
||||
fmt.setLeftMargin(100)
|
||||
fmt.setTextIndent(-100)
|
||||
cursor.mergeBlockFormat(fmt)
|
||||
|
||||
def search(self):
|
||||
to_search = self.search_line_edit.text()
|
||||
|
||||
|
@ -65,7 +65,6 @@ class Ui_MainWindow(object):
|
||||
self.detail_text_edit.setObjectName(u"detail_text_edit")
|
||||
self.detail_text_edit.setStyleSheet(u"background-color: rgb(42, 42, 42);")
|
||||
self.detail_text_edit.setFrameShape(QFrame.NoFrame)
|
||||
self.detail_text_edit.setLineWrapMode(QTextEdit.NoWrap)
|
||||
self.detail_text_edit.setReadOnly(True)
|
||||
self.splitter.addWidget(self.detail_text_edit)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user