Attachment 'processTS.py'

Download

   1 #!/usr/bin/python
   2 # -*- coding: utf8 -*-
   3 # Dieses Script für TS-Segmente welche vom Linux VDR bei der Aufnahme generiert werden per Binärkopie
   4 # zu einer TS-Datei zusammen und benennt die Datei nach den Titelinfos in der Info-Datei, welche vom
   5 # VDR generiert werden.
   6 
   7 # Importiere notwendige Module
   8 import os, glob, shutil, sys
   9 
  10 # Quellpfad wird vom VDR per Postrecording Hook oder Editing Hook an das Script übergeben
  11 source_path = sys.argv[1]
  12 
  13 print "Quellpfad " + source_path
  14 
  15 # Dateinamen plus Pfad zur zugehörigen Info-Datei zusammenbasteln
  16 source_info = source_path + "/info"
  17 
  18 # Titelinfo aus Info-Datei auslesen
  19 f = open(source_info)
  20 info_lines = f.readlines()
  21 f.close()
  22 
  23 Titel = ""
  24 Subtitel = ""
  25 
  26 for line in info_lines:
  27   if line[:1] == 'T':
  28     Titel = line
  29   if line[:1] == 'S':
  30     Subtitel = line
  31   
  32 
  33 # Unnötige Whitespaces & Sonderzeichen putzen
  34 Titel = Titel[2:].strip() + '-' + Subtitel[2:].strip()
  35 Titel = Titel.replace (" ", "_")
  36 Titel = Titel.replace ("?", "_")
  37 Titel = Titel.replace (".", "_")
  38 Titel = Titel.replace ("/", "_")
  39 Titel = Titel.replace ("(", "_")
  40 Titel = Titel.replace (")", "_")
  41 
  42 # Namen der Zieldatei inklusive Extension generieren
  43 # Zielpfad liegt im Homeverzeichnis des Hauptbenutzers und gehört der
  44 # Gruppe VDR mit Schreibrechten
  45 Zieldatei = '/home/<euer-user>/Pfad/zu/den/VDR-Videos/' +  Titel + '.ts'
  46 
  47 sourcefiles = []
  48 
  49 # Alle ts-Dateien der Aufnahme finden
  50 for filename in glob.iglob(os.path.join(source_path, '*.ts')):
  51   sourcefiles.append (filename)
  52 
  53 # Array mit den Quelldateinamen sortieren um sie in der korrekten Reihenfolge anzuhängen
  54 sourcefiles = sorted(sourcefiles)
  55 
  56 # Zieldatei zum Schreiben öffnen
  57 destination = open(Zieldatei, 'wb')
  58 
  59 # Alle ts-Dateien der Aufnahme binär zusammenfügen
  60 for source_ts in sourcefiles:
  61     print 'Merging ' + source_ts
  62     shutil.copyfileobj(open(source_ts, 'rb'), destination)
  63 
  64 # Zieldatei schließen
  65 destination.close()

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2016-11-14 17:51:45, 3344.0 KB) [[attachment:20161106_MausTOETLPD.pdf]]
  • [get | view] (2009-09-02 13:30:56, 4.6 KB) [[attachment:88x31_CC_by.png]]
  • [get | view] (2015-02-28 11:08:43, 645.2 KB) [[attachment:Anleitung_DVB.pdf]]
  • [get | view] (2018-10-24 08:30:33, 397.6 KB) [[attachment:Arch_Chromebook.pdf]]
  • [get | view] (2018-04-25 06:45:25, 939.7 KB) [[attachment:Bionic.pdf]]
  • [get | view] (2012-04-27 18:49:13, 258.7 KB) [[attachment:Bluetooth_Folien.pdf]]
  • [get | view] (2014-05-28 11:05:38, 170.4 KB) [[attachment:Command line FraLUG.pdf]]
  • [get | view] (2010-04-06 11:21:53, 180.6 KB) [[attachment:DVDAuthoring_LuG.odp]]
  • [get | view] (2016-10-31 21:05:09, 265.3 KB) [[attachment:DVDAuthoring_LuG.pdf]]
  • [get | view] (2016-10-26 14:09:16, 3666.0 KB) [[attachment:DevOps_CI_Vor.pdf]]
  • [get | view] (2012-07-10 15:11:33, 2323.5 KB) [[attachment:Digitalphotographie - FraLUG.pdf]]
  • [get | view] (2016-09-28 18:48:38, 313.8 KB) [[attachment:Docker_Vortrag_FLUG_September_2016.pdf]]
  • [get | view] (2009-11-10 08:04:08, 338.6 KB) [[attachment:FLUGS-Logo.svg]]
  • [get | view] (2016-04-29 10:36:12, 1019.1 KB) [[attachment:FLUG_2016_arch.pdf]]
  • [get | view] (2017-07-26 09:39:02, 853.9 KB) [[attachment:FLUG_LO_Dev.pdf]]
  • [get | view] (2017-04-26 07:51:44, 1343.5 KB) [[attachment:FLUG_anon_2017.pdf]]
  • [get | view] (2013-03-25 23:04:50, 33.6 KB) [[attachment:FRALUG_Logo.png]]
  • [get | view] (2013-03-08 13:35:10, 728.8 KB) [[attachment:FRALUG_htpc.pdf]]
  • [get | view] (2018-09-14 09:17:17, 45.9 KB) [[attachment:Filesystem.pdf]]
  • [get | view] (2017-01-25 12:13:59, 2956.4 KB) [[attachment:Fluxbox.pdf]]
  • [get | view] (2018-01-26 16:20:47, 948.3 KB) [[attachment:Folien_Deep_Learning_FraLUG.pdf]]
  • [get | view] (2017-01-25 11:57:42, 2967.2 KB) [[attachment:FraLUG_Beamer_Latex_style.tar.bz2]]
  • [get | view] (2019-05-26 10:32:49, 38.8 KB) [[attachment:FreeDroid.pdf]]
  • [get | view] (2015-03-01 14:23:56, 191238.4 KB) [[attachment:HTPC_Teil1.mkv]]
  • [get | view] (2015-03-01 14:36:31, 581834.6 KB) [[attachment:HTPC_Teil2.mkv]]
  • [get | view] (2015-01-29 19:01:57, 715.0 KB) [[attachment:HTPC_Teil_1.pdf]]
  • [get | view] (2015-02-28 11:06:05, 703.2 KB) [[attachment:HTPC_Teil_2.pdf]]
  • [get | view] (2009-09-02 15:43:40, 1400.9 KB) [[attachment:LUG Vortrag v0-1.otp]]
  • [get | view] (2017-01-10 20:05:42, 1110.3 KB) [[attachment:LUG_Beamer.tar.gz]]
  • [get | view] (2014-09-23 21:35:57, 121.0 KB) [[attachment:Linux Filesystem FraLUG.pdf]]
  • [get | view] (2016-11-24 19:56:22, 2812.6 KB) [[attachment:Linux_fralug_handout.pdf]]
  • [get | view] (2016-02-26 15:13:33, 1159.1 KB) [[attachment:MItgliederversammlung 2016]]
  • [get | view] (2013-06-06 21:28:15, 384.3 KB) [[attachment:Mail und SMTP.pdf]]
  • [get | view] (2016-10-23 17:10:49, 3332.7 KB) [[attachment:MausTÖTLPD.pdf]]
  • [get | view] (2018-09-26 06:34:40, 511.1 KB) [[attachment:NoSQL.pdf]]
  • [get | view] (2018-01-26 16:22:26, 273.5 KB) [[attachment:Notebook_Custom_Classifier.pdf]]
  • [get | view] (2018-01-26 16:22:33, 303.5 KB) [[attachment:Notebook_Feature_Extraction.pdf]]
  • [get | view] (2018-01-26 16:22:40, 319.8 KB) [[attachment:Notebook_General_Classifier.pdf]]
  • [get | view] (2011-02-28 23:16:44, 312.6 KB) [[attachment:Openstreetmap_technical_documentation.pdf]]
  • [get | view] (2009-11-10 07:54:35, 485.5 KB) [[attachment:Packete_bauen.pdf]]
  • [get | view] (2009-01-14 16:31:44, 1423.0 KB) [[attachment:Programmieren_mit_Gambas.pdf]]
  • [get | view] (2011-10-26 08:32:41, 114.9 KB) [[attachment:SSD unter Linux_FraLUG.odp]]
  • [get | view] (2011-10-26 08:32:59, 208.9 KB) [[attachment:SSD unter Linux_FraLUG.pdf]]
  • [get | view] (2010-11-23 21:14:26, 31.7 KB) [[attachment:Skript_und_Compilersprachen.odt]]
  • [get | view] (2010-11-23 21:15:56, 121.8 KB) [[attachment:Skript_und_Compilersprachen.pdf]]
  • [get | view] (2010-11-23 21:23:59, 14.1 KB) [[attachment:Skript_und_Compilersprachen.tgz]]
  • [get | view] (2015-08-26 05:59:11, 137.9 KB) [[attachment:SocEng.pdf]]
  • [get | view] (2011-02-28 23:03:47, 745.2 KB) [[attachment:Stromsparen_LUGWeb.odp]]
  • [get | view] (2011-02-28 22:59:39, 536.6 KB) [[attachment:Stromsparen_LUGWeb.pdf]]
  • [get | view] (2010-01-29 23:47:38, 349.4 KB) [[attachment:Videoencoding_with_OSS.odp]]
  • [get | view] (2016-10-31 21:05:02, 327.4 KB) [[attachment:Videoencoding_with_OSS.pdf]]
  • [get | view] (2019-03-07 20:12:49, 423.3 KB) [[attachment:Vortrag_KonfigDateienBash.pdf]]
  • [get | view] (2012-08-16 22:03:58, 5.9 KB) [[attachment:blender.png]]
  • [get | view] (2011-02-28 23:07:11, 3619.1 KB) [[attachment:booting.odp]]
  • [get | view] (2013-01-28 19:52:44, 9.5 KB) [[attachment:dwarffortress.png]]
  • [get | view] (2015-02-28 11:07:05, 2.1 KB) [[attachment:findAC3.py]]
  • [get | view] (2015-09-23 13:30:53, 75.7 KB) [[attachment:fralug_b-trees_web.pdf]]
  • [get | view] (2015-09-23 13:30:45, 40.8 KB) [[attachment:fralug_btrfs_live.pdf]]
  • [get | view] (2015-09-23 13:30:32, 112.4 KB) [[attachment:fralug_btrfs_web.pdf]]
  • [get | view] (2019-09-09 05:36:50, 4379.9 KB) [[attachment:fsfe_fralug.pdf]]
  • [get | view] (2012-08-16 22:04:33, 11.7 KB) [[attachment:icinga.png]]
  • [get | view] (2012-08-16 22:10:15, 4.7 KB) [[attachment:munin.png]]
  • [get | view] (2015-02-28 12:26:37, 191238.4 KB) [[attachment:part1.mkv]]
  • [get | view] (2012-08-16 22:04:18, 4.1 KB) [[attachment:pdf.png]]
  • [get | view] (2009-09-02 13:17:40, 2774.7 KB) [[attachment:penguin-crossing-FLUGS.jpg]]
  • [get | view] (2009-09-02 13:25:03, 21.4 KB) [[attachment:penguin-crossing-FLUGS_100.jpg]]
  • [get | view] (2011-02-28 23:04:25, 990.6 KB) [[attachment:praesentation.pdf]]
  • [get | view] (2015-02-28 11:07:16, 1.9 KB) [[attachment:processTS.py]]
  • [get | view] (2009-01-14 16:32:20, 10.0 KB) [[attachment:programm.tgz]]
  • [get | view] (2011-04-26 20:13:48, 59.3 KB) [[attachment:regexp.odt]]
  • [get | view] (2011-04-26 20:13:23, 121.5 KB) [[attachment:regexp.pdf]]
  • [get | view] (2014-02-18 19:42:43, 156.9 KB) [[attachment:revolutionos.pdf]]
  • [get | view] (2019-10-22 21:23:02, 1110.6 KB) [[attachment:rust.pdf]]
  • [get | view] (2014-08-26 16:00:30, 563.7 KB) [[attachment:seafile.pdf]]
  • [get | view] (2015-06-13 07:47:45, 477.3 KB) [[attachment:stallmanflyerlug.pdf]]
  • [get | view] (2016-01-27 15:33:53, 215.9 KB) [[attachment:systemd.pdf]]
  • [get | view] (2011-02-28 23:05:24, 3155.8 KB) [[attachment:virtualisierung.pdf]]
  • [get | view] (2019-07-24 05:18:51, 9574.6 KB) [[attachment:vortrag_conky.tar.xz]]
  • [get | view] (2019-10-22 21:26:02, 1.5 KB) [[attachment:webserver.rs]]
  • [get | view] (2014-07-23 06:46:34, 221.5 KB) [[attachment:wifiLinux.pdf]]
  • [get | view] (2010-02-24 14:02:16, 4314.6 KB) [[attachment:wiki-intro.odp]]
  • [get | view] (2011-07-26 15:27:19, 236.4 KB) [[attachment:x11-1-.pdf]]
  • [get | view] (2011-06-29 09:22:11, 273.4 KB) [[attachment:x11-1-history.odt]]
  • [get | view] (2011-06-29 09:20:27, 262.0 KB) [[attachment:x11-1-history.pdf]]
  • [get | view] (2011-07-26 15:27:59, 75.5 KB) [[attachment:x11-1.odp]]
  • [get | view] (2011-07-26 15:28:35, 236.4 KB) [[attachment:x11-1.pdf]]
  • [get | view] (2012-04-12 15:56:26, 44.8 KB) [[attachment:x11-2.odp]]
  • [get | view] (2012-04-12 15:57:07, 215.7 KB) [[attachment:x11-2.pdf]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.