Esempio n. 1
0
SONG_FIELDS = set(
    ('inputFrameRate', 'backgroundColor', 'videoHeight', 'videoWidth',
     'uploadYouTube', 'coverArt', 'videoDescription', 'videoTags',
     'videoTitle', 'videoVisibility', 'fileOutputDir', 'fileOutputName',
     'playlistName', 'commandString'))
ALBUM_FIELDS = set(
    ('albumPlaylist', 'fileOutputDirAlbum', 'fileOutputNameAlbum',
     'uploadYouTube', 'videoDescriptionAlbum', 'videoTagsAlbum',
     'videoTitleAlbum', 'videoVisibilityAlbum'))

QDir.temp().mkdir(APPLICATION)
QRC_TO_FILE_PATH = {
    ":/image/default.jpg":
    QDir.temp().absoluteFilePath("./{}/qrc_default.jpg".format(APPLICATION))
}

for qrc, file in QRC_TO_FILE_PATH.items():
    # unpack resources so ffmpeg can use them
    QFile.copy(qrc, file)


# clear temp dir on exit
def clean_up_images():
    temp_dir = QDir("{}/{}".format(QDir().tempPath(), APPLICATION))
    temp_dir.setNameFilters(["*.cover"])
    for file in temp_dir.entryList():
        temp_dir.remove(file)


atexit.register(clean_up_images)
Esempio n. 2
0
from PySide6.QtWebSockets import QWebSocketServer

from dialog import Dialog
from core import Core
from websocketclientwrapper import WebSocketClientWrapper


if __name__ == '__main__':
    app = QApplication(sys.argv)
    if not QSslSocket.supportsSsl():
        print('The example requires SSL support.')
        sys.exit(-1)
    cur_dir = os.path.dirname(os.path.abspath(__file__))
    jsFileInfo = QFileInfo(cur_dir + "/qwebchannel.js")
    if not jsFileInfo.exists():
        QFile.copy(":/qtwebchannel/qwebchannel.js",
                   jsFileInfo.absoluteFilePath())

    # setup the QWebSocketServer
    server = QWebSocketServer("QWebChannel Standalone Example Server",
                              QWebSocketServer.NonSecureMode)
    if not server.listen(QHostAddress.LocalHost, 12345):
        print("Failed to open web socket server.")
        sys.exit(-1)

    # wrap WebSocket clients in QWebChannelAbstractTransport objects
    clientWrapper = WebSocketClientWrapper(server)

    # setup the channel
    channel = QWebChannel()
    clientWrapper.clientConnected.connect(channel.connectTo)