move files to directory with proper name; print arguments and field in filename
This commit is contained in:
parent
48d32924fa
commit
157b0ce047
|
@ -13,7 +13,8 @@ You should have received a copy of the GNU Affero General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>."""
|
along with this program. If not, see <https://www.gnu.org/licenses/>."""
|
||||||
|
|
||||||
from argparse import ArgumentParser, BooleanOptionalAction
|
from argparse import ArgumentParser, BooleanOptionalAction
|
||||||
# import dirproc
|
|
||||||
|
from .procdir import *
|
||||||
|
|
||||||
psr = ArgumentParser(
|
psr = ArgumentParser(
|
||||||
description="OPUS Swiss Army Knife 0.1.0",
|
description="OPUS Swiss Army Knife 0.1.0",
|
||||||
|
@ -22,5 +23,4 @@ psr = ArgumentParser(
|
||||||
psr.add_argument("dir", nargs="+")
|
psr.add_argument("dir", nargs="+")
|
||||||
|
|
||||||
for i in psr.parse_args().dir:
|
for i in psr.parse_args().dir:
|
||||||
print(i)
|
process(i)
|
||||||
# dirproc.proc(i)
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
import os
|
||||||
|
import brukeropusreader as bor
|
||||||
|
import re
|
||||||
|
|
||||||
|
match_opus = re.compile(r"_[0-9]+(\.[0-9]+)?T.0$")
|
||||||
|
|
||||||
|
def ifnot(d,v):
|
||||||
|
if v not in d:
|
||||||
|
d[v] = {}
|
||||||
|
|
||||||
|
def process(s):
|
||||||
|
for fn in os.listdir(s):
|
||||||
|
v = re.search(match_opus, fn)
|
||||||
|
if v is None:
|
||||||
|
continue
|
||||||
|
field = v.group()[1:len(v.group())-2]
|
||||||
|
print(fn)
|
||||||
|
print(field)
|
||||||
|
print()
|
Loading…
Reference in New Issue