Browse Source

clean up imports (ordering)

pull/82/head
Amar1729 5 months ago
parent
commit
f9563bf808
11 changed files with 59 additions and 34 deletions
  1. +3
    -1
      LikedSavedDatabase.py
  2. +8
    -6
      LikedSavedDownloaderServer.py
  3. +14
    -11
      imageSaver.py
  4. +9
    -7
      imgurDownloader.py
  5. +3
    -0
      pixivScraper.py
  6. +5
    -4
      redditScraper.py
  7. +1
    -1
      redditUserImageScraper.py
  8. +3
    -1
      submission.py
  9. +5
    -1
      tumblrScraper.py
  10. +2
    -0
      utilities.py
  11. +6
    -2
      videoDownloader.py

+ 3
- 1
LikedSavedDatabase.py View File

@ -1,8 +1,10 @@
import json
import os
import re
import settings
import sqlite3
# local imports
import settings
import submission as Submissions
# Global database


+ 8
- 6
LikedSavedDownloaderServer.py View File

@ -1,11 +1,5 @@
#!/usr/bin/env python
import tornado.ioloop
import tornado.web
import tornado.websocket
import tornado.httpclient
import tornado.gen
import json
import multiprocessing
import os
@ -14,6 +8,14 @@ import shutil
import threading
import webbrowser
# third-party imports
import tornado.ioloop
import tornado.web
import tornado.websocket
import tornado.httpclient
import tornado.gen
# local imports
import utilities
import settings
import redditUserImageScraper


+ 14
- 11
imageSaver.py View File

@ -1,25 +1,14 @@
# -*- coding: utf-8 -*-
import LikedSavedDatabase
import imgurDownloader
import json
import logger
import os
import random
import re
import settings
import submission as Submissions
import sys
import time
import utilities
import videoDownloader
# Must use API to access images
from pixivpy3 import *
from builtins import str
from crcUtils import signedCrc32
from gfycat.client import GfycatClient
from operator import attrgetter
import urllib
@ -29,6 +18,20 @@ if sys.version_info[0] >= 3:
else:
from urllib import urlretrieve, urlopen
# third-party imports
# Must use API to access images
from pixivpy3 import *
from gfycat.client import GfycatClient
# local imports
import LikedSavedDatabase
import imgurDownloader
import logger
import settings
import submission as Submissions
import videoDownloader
from crcUtils import signedCrc32
SupportedTypes = ['jpg', 'jpeg', 'gif', 'png', 'webm', 'mp4']
def getFileTypeFromUrl(url):


+ 9
- 7
imgurDownloader.py View File

@ -1,14 +1,7 @@
# -*- coding: utf-8 -*-
from crcUtils import signedCrc32
import LikedSavedDatabase
import imageSaver
import imgurpython as imgur
import logger
import os
import re
import settings
import sys
import utilities
import urllib
if sys.version_info[0] >= 3:
@ -17,6 +10,15 @@ if sys.version_info[0] >= 3:
else:
from urllib import urlretrieve, urlopen
# local imports
from crcUtils import signedCrc32
import LikedSavedDatabase
import imageSaver
import imgurpython as imgur
import logger
import settings
import utilities
def isImgurIndirectUrl(url):
# If it is imgur domain, has no file type, and isn't an imgur album
return ('imgur' in url.lower()


+ 3
- 0
pixivScraper.py View File

@ -1,4 +1,7 @@
# third-party imports
from pixivpy3 import *
# local imports
from submission import Submission
import logger


+ 5
- 4
redditScraper.py View File

@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-
import logger
# third-party imports
import praw
# local imports
import logger
import settings
import submission
from submission import Submission
#import pprint
from submission import Submission
user_agent = 'Python Script: v2.0: Reddit Liked Saved Image Downloader (by /u/makuto9)'


+ 1
- 1
redditUserImageScraper.py View File

@ -3,6 +3,7 @@
import time
import os
# local imports
import LikedSavedDatabase
import logger
import imageSaver
@ -13,7 +14,6 @@ import imgurDownloader
import settings
import submission
import utilities
import LikedSavedDatabase
scriptFinishedSentinel = '>>> runLikedSavedDownloader() Process Finished <<<'


+ 3
- 1
submission.py View File

@ -1,9 +1,11 @@
# -*- coding: utf-8 -*-
import pickle
import jsonpickle
import os
# third-party imports
import jsonpickle
class Submission:
def __init__(self):
# Source is either Tumblr or Reddit


+ 5
- 1
tumblrScraper.py View File

@ -1,8 +1,12 @@
from builtins import str
# third-party imports
import pytumblr
# local imports
import logger
from submission import Submission
from crcUtils import signedCrc32
from builtins import str
def getTumblrUserLikedSubmissions(clientId, clientSecret, tokenId, tokenSecret,
likeRequestLimit = 100, requestOnlyNewCache = None):


+ 2
- 0
utilities.py View File

@ -1,5 +1,7 @@
import re
import os
# local imports
import settings
# From https://stackoverflow.com/questions/4623446/how-do-you-sort-files-numerically


+ 6
- 2
videoDownloader.py View File

@ -1,9 +1,13 @@
import logger
import re
import settings
import ssl
# third-party imports
import youtube_dl
# local imports
import logger
import settings
alreadyDownloadedSentinel = "Already Downloaded"
# See https://ytdl-org.github.io/youtube-dl/supportedsites.html


Loading…
Cancel
Save