Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: restore from testing #8

Merged
merged 4 commits into from
Jun 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions homebox.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@
def main():
do_location_folder()
#mv_loc_parent_item()
#label_id = "2070e5f5-7e53-4aa6-bf87-a07b9e3b0d18"
#update_label(label_id)

## main loop for the files ##
def do_location_folder():
loc_idx = 0
for root, dirs, files in os.walk(loc_folder):
Expand All @@ -33,7 +31,6 @@ def do_location_folder():
loc_idx = loc_idx + 1


## get location ##
def do_location(location):
print(f"Location: {location}")
locations = hb.get_location()
Expand All @@ -46,15 +43,13 @@ def do_location(location):
location_id = hb.create_location(location)
return location_id

## added parent item ##
def do_parent_item(parent_itemname,location_id,location):
parent_item_id = hb.create_item(location_id,parent_itemname)
pic_name = f"{parent_itemname}.jpeg"
item_location = f"{loc_folder}/{location}/{parent_itemname}"
hb.upload_photo(parent_item_id,pic_name,item_location)
return parent_item_id,item_location

#added loop item#
def loop_item(location_id,item_location,parent_item_id):
for root, dirs, files in os.walk(item_location):
for item in files:
Expand Down Expand Up @@ -100,15 +95,10 @@ def loop_item(location_id,item_location,parent_item_id):
hb.update_item_label(parent_item_id,item_id,location_id,itemname,labels,labelids)


## label update ###
def update_label(label_id):
items = hb.get_items()
for item in items['items']:
#if "Feestje Twan" in item['name']:


item_details = hb.get_item_by_id(item['id'])
#print(item_details['parent']['id'])
name = item['name']
item_id = item['id']
try:
Expand All @@ -121,7 +111,6 @@ def update_label(label_id):
hb.update_item_label(parent_item_id,item_id,location_id,name)
except:
pass
## loc comment ##
def mv_loc_parent_item():
locations = hb.get_location()
for location in locations:
Expand All @@ -136,14 +125,12 @@ def mv_loc_parent_item():
print(item['name'])
print(item['id'])
hb.update_item(parent_item_id,item['id'],location_id,item['name'])
##exiftool ##

def call_ssc(FileLoc):
cmd = "-j -G -n"
ssc_exec = f"{ssc_path} {cmd} '{FileLoc}'"
output = str(subprocess.check_output(f"{ssc_exec}", shell=True, encoding='utf-8',stderr=subprocess.DEVNULL))
output = os.linesep.join([s for s in output.splitlines() if s])
#print(output)
return json.loads(output)

if __name__ == '__main__':
Expand Down