Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import logging
import time
from memacs.lib.memacs import Memacs
from orgformat import OrgFormat
from memacs.lib.orgproperty import OrgProperties
from memacs.lib.reader import CommonReader
try:
from icalendar import Calendar
except ImportError as e:
print("please install python package \"icalendar\"")
print(e)
sys.exit(3)
class CalendarMemacs(Memacs):
def _parser_add_arguments(self):
self._parser.add_argument("-c", "--calendar-url", dest="calendar_url",
help="url to calendar")
self._parser.add_argument("-cf", "--calendar-file",
dest="calendar_file",
help="path to calendar")
self._parser.add_argument(
"-x", "--exclude", dest="excludelist",
help="path to one or more folders seperated with \"|\"," + \
"i.e.:\"/path/to/folder1|/path/to/folder2|..\"")
def _parser_parse_args(self):
Memacs._parser_parse_args(self)
def _parser_add_arguments(self):
"""
overwritten method of class Memacs
add additional arguments
"""
Memacs._parser_add_arguments(self)
self._parser.add_argument(
"-f", "--file", dest="smsxmlfile",
action="store", required=True,
help="path to sms xml backup file")
self._parser.add_argument(
"--ignore-incoming", dest="ignore_incoming",
action="store_true",
help="ignore incoming smses")
self._parser.add_argument(
"--ignore-outgoing", dest="ignore_outgoing",
action="store_true",
help="ignore outgoing smses")
def _parser_add_arguments(self):
Memacs._parser_add_arguments(self)
self._parser.add_argument("-f", "--folder",
dest="filenametimestamps_folder",
action="append",
help="path to a folder to search for " +
"filenametimestamps, " +
"multiple folders can be specified: " +
"-f /path1 -f /path2")
self._parser.add_argument("-x", "--exclude", dest="exclude_folder",
help="path to excluding folder, for more excludes " +
"use this: -x /path/exclude -x /path/exclude")
self._parser.add_argument("--filelist", dest="filelist",
help="file containing a list of files to process. " +
"either use \"--folder\" or the \"--filelist\" argument, not both.")
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import time
import datetime
import logging
import sys
import pylast
from memacs.lib.orgproperty import OrgProperties
from orgformat import OrgFormat
from memacs.lib.memacs import Memacs
class LastFM(Memacs):
def _parser_add_arguments(self):
"""
overwritten method of class Memacs
add additional arguments
"""
Memacs._parser_add_arguments(self)
self._parser.add_argument(
'--output-format', dest='output_format',
action='store', default='{title}',
help='formt string to use for the output'
)
def _parser_parse_args(self):
"""
def _parser_parse_args(self):
"""
overwritten method of class Memacs
all additional arguments are parsed in here
"""
Memacs._parser_parse_args(self)
from orgformat import OrgFormat, TimestampParseException
from memacs.lib.orgproperty import OrgProperties
import re
import logging
import time
import sys
import codecs
# Note: here, the day of the month is optional to allow "2019-10
# foo.txt" as valid ISO datestamp which will be changed to
# "<2019-10-01..." later on.
DATETIME_PATTERN = '([12]\d{3})-([01]\d)(-([0123]\d))?([- _T]([012]\d)[-_.]([012345]\d)([-_.]([012345]\d))?)?'
DATETIME_REGEX = re.compile('^' + DATETIME_PATTERN + '(--?' + DATETIME_PATTERN + ')?')
class FileNameTimeStamps(Memacs):
def _parser_add_arguments(self):
Memacs._parser_add_arguments(self)
self._parser.add_argument("-f", "--folder",
dest="filenametimestamps_folder",
action="append",
help="path to a folder to search for " +
"filenametimestamps, " +
"multiple folders can be specified: " +
"-f /path1 -f /path2")
self._parser.add_argument("-x", "--exclude", dest="exclude_folder",
help="path to excluding folder, for more excludes " +
"use this: -x /path/exclude -x /path/exclude")
def _parser_add_arguments(self):
"""
overwritten method of class Memacs
add additional arguments
"""
Memacs._parser_add_arguments(self)
self._parser.add_argument(
"-u", "--url", dest="url",
action="store",
help="url to a rss file")
self._parser.add_argument(
"-f", "--file", dest="file",
action="store",
help="path to rss file")
def _parser_add_arguments(self):
"""
overwritten method of class Memacs
add additional arguments
"""
Memacs._parser_add_arguments(self)
self._parser.add_argument(
"-f", "--file", dest="csvfile", required=True,
action="store", help="input csv file", type=argparse.FileType('rb'))
self._parser.add_argument(
"-d", "--delimiter", dest="delimiter", default=";",
action="store", help='delimiter, default ";"')
self._parser.add_argument(
"-e", "--encoding", dest="encoding",
action="store", default="utf-8", help="default encoding utf-8, " +
"see http://docs.python.org/library/codecs.html#standard-encodings" +
"for possible encodings")
self._parser.add_argument(