fix: nfoguard data at bottom of file
Local Docker Build (Dev) / build-dev (push) Successful in 5s

This commit is contained in:
2025-10-23 10:53:35 -04:00
parent 6946ce2082
commit 7fb07fcddf
+8 -24
View File
@@ -509,22 +509,14 @@ class NFOManager:
lockdata = ET.SubElement(season, "lockdata") lockdata = ET.SubElement(season, "lockdata")
lockdata.text = "true" lockdata.text = "true"
# Add NFOGuard comment at the beginning # Add NFOGuard comment at the bottom
comment_text = f" Created by {self.manager_brand} " comment = ET.Comment(f" Created by {self.manager_brand} ")
season.append(comment)
# Write file with proper formatting # Write file with proper formatting
tree = ET.ElementTree(season) tree = ET.ElementTree(season)
ET.indent(tree, space=" ", level=0) ET.indent(tree, space=" ", level=0)
tree.write(nfo_path, encoding='utf-8', xml_declaration=True)
# Write to string first to add comment
xml_str = ET.tostring(season, encoding='unicode')
# Add XML declaration and comment
full_xml = f'<?xml version="1.0" encoding="utf-8"?>\n<!--{comment_text}-->\n{xml_str}'
# Write to file
with open(nfo_path, 'w', encoding='utf-8') as f:
f.write(full_xml)
print(f"✅ Successfully created/updated season NFO: {nfo_path}") print(f"✅ Successfully created/updated season NFO: {nfo_path}")
print(f" Season: {season_number}") print(f" Season: {season_number}")
@@ -709,22 +701,14 @@ class NFOManager:
lockdata = ET.SubElement(episode, "lockdata") lockdata = ET.SubElement(episode, "lockdata")
lockdata.text = "true" lockdata.text = "true"
# Add NFOGuard comment at the beginning # Add NFOGuard comment at the bottom
comment_text = f" Created by {self.manager_brand} - Source: {source} " comment = ET.Comment(f" Created by {self.manager_brand} - Source: {source} ")
episode.append(comment)
# Write file with proper formatting # Write file with proper formatting
tree = ET.ElementTree(episode) tree = ET.ElementTree(episode)
ET.indent(tree, space=" ", level=0) ET.indent(tree, space=" ", level=0)
tree.write(nfo_path, encoding='utf-8', xml_declaration=True)
# Write to string first to add comment
xml_str = ET.tostring(episode, encoding='unicode')
# Add XML declaration and comment
full_xml = f'<?xml version="1.0" encoding="utf-8"?>\n<!--{comment_text}-->\n{xml_str}'
# Write to file
with open(nfo_path, 'w', encoding='utf-8') as f:
f.write(full_xml)
print(f"✅ Successfully created/updated episode NFO: {nfo_path}") print(f"✅ Successfully created/updated episode NFO: {nfo_path}")
print(f" S{season_num:02d}E{episode_num:02d}, Aired: {aired}, Date Added: {dateadded}") print(f" S{season_num:02d}E{episode_num:02d}, Aired: {aired}, Date Added: {dateadded}")