Skip to content

Commit

Permalink
setctime function
Browse files Browse the repository at this point in the history
If os isn't windows, the script will no longer import windows function
  • Loading branch information
SecretShell committed Oct 21, 2019
1 parent 69d83b4 commit efa8c66
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
1 change: 0 additions & 1 deletion modules/four_chan.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import requests
from bs4 import BeautifulSoup
from win32_setctime import setctime
from modules.helpers import reformat

import os
Expand Down
8 changes: 8 additions & 0 deletions modules/helpers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import re
import os
from bs4 import BeautifulSoup
import platform


def parse_links(site_name, input_link):
Expand Down Expand Up @@ -63,3 +64,10 @@ def format_media_set(media_set):
x["valid"].extend(y[0])
x["invalid"].extend(y[1])
return x

def format_image(directory, timestamp):
os_name = platform.system()
if os_name == "Windows":
from win32_setctime import setctime
setctime(directory, timestamp)

6 changes: 1 addition & 5 deletions modules/justforfans.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import requests
from bs4 import BeautifulSoup
from win32_setctime import setctime
from modules.helpers import reformat
from modules.helpers import format_media_set

Expand All @@ -16,7 +15,6 @@
import logging
import inspect
import math
import platform

# Open config.json and fill in OPTIONAL information
json_config = json.load(open('config.json'))
Expand Down Expand Up @@ -276,9 +274,7 @@ def download_media(media, session, directory, username):
for chunk in r.iter_content(chunk_size=1024):
if chunk: # filter out keep-alive new chunks
f.write(chunk)
os_name = platform.system()
if os_name == "Windows":
setctime(directory, timestamp)
format_image(directory, timestamp)
print(link)
return True

Expand Down
7 changes: 2 additions & 5 deletions modules/onlyfans.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import requests
from bs4 import BeautifulSoup
from win32_setctime import setctime
from modules.helpers import reformat
from modules.helpers import format_media_set
from modules.helpers import format_image

import os
import json
Expand All @@ -16,7 +16,6 @@
import logging
import inspect
import math
import platform

# Open config.json and fill in OPTIONAL information
json_config = json.load(open('config.json'))
Expand Down Expand Up @@ -253,9 +252,7 @@ def download_media(media, session, directory, username):
for chunk in r.iter_content(chunk_size=1024):
if chunk: # filter out keep-alive new chunks
f.write(chunk)
os_name = platform.system()
if os_name == "Windows":
setctime(directory, timestamp)
format_image(directory, timestamp)
print(link)
return True

Expand Down

0 comments on commit efa8c66

Please sign in to comment.