Example #1
0
 def test_compat_expanduser(self):
     old_home = os.environ.get('HOME')
     test_str = 'C:\Documents and Settings\тест\Application Data'
     os.environ['HOME'] = (test_str if sys.version_info >= (3, 0) else
                           test_str.encode(get_filesystem_encoding()))
     self.assertEqual(compat_expanduser('~'), test_str)
     os.environ['HOME'] = old_home
Example #2
0
 def test_compat_expanduser(self):
     old_home = os.environ.get('HOME')
     test_str = 'C:\Documents and Settings\тест\Application Data'
     os.environ['HOME'] = (
         test_str if sys.version_info >= (3, 0)
         else test_str.encode(get_filesystem_encoding()))
     self.assertEqual(compat_expanduser('~'), test_str)
     os.environ['HOME'] = old_home
def youtube_dl_wrapper(urls, id_from_url, play, destdir):
    if not urls:
        ceprint("no args, checking clipboard for urls")
        urls = get_clipboard_urls()

    cache_folder = compat_expanduser(destdir)
    try:
        os.chdir(cache_folder)
    except FileNotFoundError:
        print("Unable to os.chdir() to", cache_folder, "Press enter to retry.")
        os.sys('pause')
        os.chdir(cache_folder)

    for url in urls:
        print(url)
        if id_from_url:
            print(download_id_for_url(url))
            continue
        download_url(url=url, cache_dir=cache_folder, play=play)
        print(" ")
Example #4
0
 def test_compat_expanduser(self):
     old_home = os.environ.get('HOME')
     test_str = r'C:\Documents and Settings\тест\Application Data'
     compat_setenv('HOME', test_str)
     self.assertEqual(compat_expanduser('~'), test_str)
     compat_setenv('HOME', old_home or '')
Example #5
0
	def test_compat_expanduser(self):
		old_home = os.environ.get('HOME')
		test_str = r'C:\Documents and Settings\тест\Application Data'
		compat_setenv('HOME', test_str)
		self.assertEqual(compat_expanduser('~'), test_str)
		compat_setenv('HOME', old_home or '')