options = Options()
profile_dir_name = None
if len(sys.argv) > 1:
profile_dir_name = sys.argv[1]
if profile_dir_name == None:
profile_dir_name = 'CustomProfile'
user_data_dir = '{0}\\AppData\\Local\\Google\\Chrome\\User Data\\{1}'.format(os.getenv('USERPROFILE'), profile_dir_name) if is_windows else '{0}/.config/{1}'.format(os.getenv('HOME'), profile_dir_name)
if os.path.isdir(user_data_dir):
print('Custom profile will be used: "{}"'.format(user_data_dir), file = sys.stderr)
else:
print('Custom profile will be created: "{}"'.format(user_data_dir), file = sys.stderr)
options.add_argument('--allow-profiles-outside-user-dir')
options.add_argument('--enable-profile-shortcut-manager')
options.add_argument('--profile-directory={}'.format(profile_dir_name))
options.add_argument( 'user-data-dir={}'.format(user_data_dir))
try:
driver = webdriver.Chrome(executable_path = chromedriver_path, options = options)
# switch to some frame
driver.switch_to.frame("packageListFrame")
# click on somethig
driver.find_element_by_link_text("org.openqa.selenium.opera").click()
# back to default web page frame
driver.switch_to.default_content()
@echo OFF
SETLOCAL ENABLEDELAYEDEXPANSION
REM example output
REM Duration: 00:05:22.17, start: 0.000000, bitrate: 326 kb/s
for /F "tokens=2" %%. in ('ffmpeg -i a.mp3 2^>^&1 ^| find "Duration"') do SET z=%%.
ECHO !Z!
set Z1=!Z:~0,2!
set Z2=!Z:~3,2!
set Z3=!Z:~6,2!
ECHO !Z1!
ECHO !Z2!
ECHO !Z3!
REM
set /A x=!Z1! * 3600 + !Z2! * 60 + !Z3!
echo !x!
00:05:22.17,
00
05
22
322
julianday
использовать не рекомендуется а epoch
(a.k.a. strfime "%s"
все работает так как epoch это секунды с 01.01.1970 select CAST( strftime('%s',datetime(date_end, time_end ) ) AS LONG ), CAST( strftime('%s',datetime(date_start, time_start ) ) AS LONG) from _variables;
select STRFTIME("%H:%M:%S", CAST( strftime('%s',datetime(date_end, time_end ) ) AS LONG ) - CAST( strftime('%s',datetime(date_start, time_start ) ) AS LONG) )from _variables;
12:00:00
drop table IF EXISTS _Variables;
CREATE TEMP TABLE _Variables(date_end date, time_end time, date_start date, time_start time) ;
INSERT INTO _Variables VALUES ('2022-01-21', '13:00:00', '2022-01-21', '01:00:00');
select STRFTIME("%H:%M:%S", julianday(datetime(date_end, time_end )) - julianday(datetime(date_start, time_start ))) from _variables;
00:00:00
python3 with_profile.py test_profile
find /home/sergueik/.config/test_profile