diff --git a/SUMMARY.md b/SUMMARY.md
index 697daef..bb56df8 100644
--- a/SUMMARY.md
+++ b/SUMMARY.md
@@ -1,36 +1,40 @@
# NFOGuard Development Summary
-## Current Status: v1.3.8 - NFO Field Ordering Fix
+## Current Status: v1.4.0 - Complete Date Field Management
-### Latest Updates (v1.3.8)
-- **๐ฏ FIELD ORDERING**: NFOGuard fields now append at bottom of existing NFO content
-- **๐ STRUCTURE**: Date fields (premiered, dateadded, lockdata) appear after all existing metadata
-- **โ
PRESERVATION**: All existing content (actors, plot, ratings, etc.) maintained in original order
-- **๐งน SMART CLEANUP**: Only removes NFOGuard-added elements, preserves existing uniqueid[tmdb]
+### Latest Updates (v1.4.0)
+- **๐ฏ ALL DATE FIELDS**: Now moves premiered, year, dateadded, and lockdata to bottom
+- **๐ COMPREHENSIVE**: Removes existing premiered/year fields and re-adds at bottom
+- **โ
PRESERVATION**: Preserves existing premiered date if no new release date provided
+- **๐งน CLEAN STRUCTURE**: All date/metadata fields grouped together at bottom
-### NFO Field Order (Fixed)
-**Now places NFOGuard fields at the bottom:**
+### Complete NFO Structure (Fixed)
```xml
- Movie Title
+ Annabelle Comes Home
Plot content...
+ 521029
+ Horror
+ Gary Dauberman
...
-
+
-
+
tt8350360
- 2019-06-26
- 2025-09-14T13:45:54-04:00
+ 2019-06-26
+ 2019
+ 2025-09-14T13:50:34-04:00
true
```
-### Smart Element Management
-- โ
Preserves existing `uniqueid[tmdb]` and other IDs
-- โ
Only removes NFOGuard-managed `uniqueid[imdb]` to avoid duplicates
-- โ
Appends new fields using `ET.SubElement()` for bottom placement
-- โ
Maintains clean XML structure and formatting
+### NFOGuard Managed Fields
+- โ
`uniqueid[type="imdb"]` - IMDb ID for identification
+- โ
`premiered` - Release date (moved to bottom)
+- โ
`year` - Extracted from premiered date
+- โ
`dateadded` - Import timestamp
+- โ
`lockdata` - Prevents metadata overwrites
### Complete Path Processing Pipeline
- โ
**Path Mapping**: Fixed substring matching (movies/movies6, tv/tv6)
diff --git a/VERSION b/VERSION
index e05cb33..88c5fb8 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.3.8
+1.4.0
diff --git a/core/nfo_manager.py b/core/nfo_manager.py
index c1a36bc..2ee5b65 100644
--- a/core/nfo_manager.py
+++ b/core/nfo_manager.py
@@ -52,17 +52,20 @@ class NFOManager:
raise ValueError("Root element is not ")
# Remove existing NFOGuard-managed elements to avoid duplicates
- # These will be re-added at the bottom
- for tag in ["dateadded", "lockdata"]:
+ # These will be re-added at the very bottom
+ nfoguard_fields = ["dateadded", "lockdata", "premiered", "year"]
+ for tag in nfoguard_fields:
existing = movie.find(tag)
if existing is not None:
+ # Store the value before removing (for premiered/year)
+ if tag == "premiered" and not released:
+ released = existing.text # Preserve existing premiered date
movie.remove(existing)
- # Remove any existing uniqueid with type="imdb" added by NFOGuard
- # (Keep other uniqueid elements like tmdb)
+ # Remove ALL existing uniqueid with type="imdb" regardless of attributes
+ # We'll add a clean one at the bottom
for uniqueid in movie.findall("uniqueid[@type='imdb']"):
- if uniqueid.get('default') == 'true':
- movie.remove(uniqueid)
+ movie.remove(uniqueid)
except (ET.ParseError, ValueError) as e:
print(f"Warning: Could not parse existing NFO {nfo_path}, creating new: {e}")
@@ -71,17 +74,26 @@ class NFOManager:
# Create new NFO structure
movie = ET.Element("movie")
- # Now append NFOGuard fields at the END of the file
- # This ensures they appear after all existing content
+ # Now append ALL NFOGuard and date fields at the VERY END of the file
+ # This ensures they appear after all existing content including actors
- # Add/update IMDb uniqueid at the end
+ # Add IMDb uniqueid at the end (after all existing content)
uniqueid = ET.SubElement(movie, "uniqueid", type="imdb", default="true")
uniqueid.text = imdb_id
- # Add premiered if we have release date (only if not already present)
- if released and movie.find("premiered") is None:
+ # Add premiered date at the bottom if we have it
+ if released:
premiered_elem = ET.SubElement(movie, "premiered")
premiered_elem.text = released[:10] if len(released) >= 10 else released
+
+ # Extract year from premiered date for consistency
+ try:
+ year_value = released[:4] if len(released) >= 4 else None
+ if year_value and year_value.isdigit():
+ year_elem = ET.SubElement(movie, "year")
+ year_elem.text = year_value
+ except:
+ pass # Skip year if we can't extract it
# Add dateadded at the end
if dateadded: