# Should we start recording the original path and filename on import?

**URL:** <https://discourse.beets.io/t/should-we-start-recording-the-original-path-and-filename-on-import/1494>\
**Category:** Development\
**Created:** [September 6, 2020, 1:00am UTC](https://discourse.beets.io/t/should-we-start-recording-the-original-path-and-filename-on-import/1494 "2020-09-06T01:00:08Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![RollingStar](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/rollingstar/32/728_2.png) [@RollingStar](https://discourse.beets.io/u/RollingStar)\
**Post date:** [September 6, 2020, 1:00am UTC](https://discourse.beets.io/t/should-we-start-recording-the-original-path-and-filename-on-import/1494/1 "2020-09-06T01:00:08Z")

</div>

As I said [here](https://discourse.beets.io/t/project-roadmap/1291), I think recording this information would raise confidence in Beets and allow it to become more lossless. It keeps more options open for beets development in the future. (Imagine taking a second pass at autotagging your library after it received an upgrade that’s better able to understand filenames).

To me the only question is if this should be a plugin or if it should be base functionality. I do welcome feedback if this is a bad idea somehow. What kind of tradeoff must be considered instead of adding fields willy-nilly?

---

<div class="post-metadata">

**Author:** ![adrian](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/adrian/32/4_2.png) [@adrian](https://discourse.beets.io/u/adrian)\
**Post date:** [September 7, 2020, 1:58am UTC](https://discourse.beets.io/t/should-we-start-recording-the-original-path-and-filename-on-import/1494/2 "2020-09-07T01:58:10Z")

</div>

Sounds reasonable! Seems like adding this in a flexible attribute by default can’t hurt.

---

<div class="post-metadata">

**Author:** ![RollingStar](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/rollingstar/32/728_2.png) [@RollingStar](https://discourse.beets.io/u/RollingStar)\
**Post date:** [September 7, 2020, 7:07pm UTC](https://discourse.beets.io/t/should-we-start-recording-the-original-path-and-filename-on-import/1494/3 "2020-09-07T19:07:21Z")

</div>

Would this be a good template to follow for native flex attributes? Are there any other flex attributes in base beets? Everything else I see in `beet fields` was added by me or a plugin. How does the process of doing it in a plugin vs. base compare?

> <https://github.com/beetbox/beets/pull/1322/files>

Further reading: [https://beets.io/blog/flexattr.html](https://beets.io/blog/flexattr.html)

---

<div class="post-metadata">

**Author:** ![adrian](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/adrian/32/4_2.png) [@adrian](https://discourse.beets.io/u/adrian)\
**Post date:** [September 7, 2020, 8:55pm UTC](https://discourse.beets.io/t/should-we-start-recording-the-original-path-and-filename-on-import/1494/4 "2020-09-07T20:55:42Z")

</div>

Absolutely!

---

<div class="post-metadata">

**Author:** ![bearcatsandor](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/bearcatsandor/32/488_2.png) [@bearcatsandor](https://discourse.beets.io/u/bearcatsandor)\
**Post date:** [February 20, 2021, 11:37pm UTC](https://discourse.beets.io/t/should-we-start-recording-the-original-path-and-filename-on-import/1494/5 "2021-02-20T23:37:33Z")

</div>

Are you suggesting that “/home/moonwind/Downloads/not\_processed/please\_tell\_the\_FBI\_that\_I\_own\_the\_cd/all\_metallica/ride\_the\_lighning/forwhotehbeltools.mp3” be placed into the file tags? Most of the time these are temporary holding places.

---

<div class="post-metadata">

**Author:** ![bogpatin](https://avatars.discourse-cdn.com/v4/letter/b/d9b06d/32.png) [@bogpatin](https://discourse.beets.io/u/bogpatin)\
**Post date:** [March 2, 2021, 1:47pm UTC](https://discourse.beets.io/t/should-we-start-recording-the-original-path-and-filename-on-import/1494/6 "2021-03-02T13:47:24Z")

</div>

Hi, @RollingStar , it would be very handy this of recording original path and filename.  
Have you arrived to any possibility of this implementation?  
Have you or anyone a plugin or any way for doing this?  
Thanks for any clue.

---

<div class="post-metadata">

**Author:** ![RollingStar](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/rollingstar/32/728_2.png) [@RollingStar](https://discourse.beets.io/u/RollingStar)\
**Post date:** [March 23, 2021, 3:18am UTC](https://discourse.beets.io/t/should-we-start-recording-the-original-path-and-filename-on-import/1494/7 "2021-03-23T03:18:44Z")

</div>

I can’t directly help you. I have a small test function that might help if someone wanted to continue working on it.

I do want to implement this, but I won’t have time for months.

This is a test case I was adding to `test_files.py` within `/src/beets/test`. It’s not finished.

```auto
    def test_albuminfo_move_keeps_most_fields(self):
        # any field not defined here, or tracked/created by a plugin, should not change with a move
        # this uses the Python concept of a "key" / "value" pair rather
        # than the beets concept of a "field". in here, "key" <-> "field".
        import pdb
        fluid_item_keys = ['path', 'mtime']
        fluid_album_keys = ['path', 'artpath']
        old_item_keys = {}
        old_album_keys = {}
        static_item_keys = self.i.all_keys()
        static_album_keys = self.ai.all_keys()
        # todo get old_dict and compare to new_dict
        for ikey in fluid_item_keys:
            # old_item_keys[ikey] = self.i.get(ikey)
            static_item_keys.remove(ikey)
        for akey in fluid_album_keys:
            # old_album_keys[akey] = self.ai.get(akey)
            static_album_keys.remove(akey)
        self.ai.move(operation=MoveOperation.MOVE)
        self.ai.store()
        self.i.load()
        new_item_keys = self.i.all_keys()
        new_album_keys = self.ai.all_keys()
        for ikey in fluid_item_keys:
            new_item_keys.remove(ikey)
        for akey in fluid_album_keys:
            new_album_keys.remove(akey)
        # is there a way to compare them non-iteratively?
        for ikey in new_item_keys:
            print(ikey)
            pdb.set_trace()
            self.assertEqual(static_item_keys[ikey], new_item_keys[ikey])
        for akey in new_album_keys:
            print(akey)
            self.assertEqual(static_album_keys[akey], new_album_keys[akey])

```

The point of this test function is to verify that individual fields (such as artist name) do not change when the file location changes. The file path is a special case - it **should** change when the file location changes.

* * *

> Are you suggesting that “/home/moonwind/Downloads/not\_processed/please\_tell\_the\_FBI\_that\_I\_own\_the\_cd/all\_metallica/ride\_the\_lighning/forwhotehbeltools.mp3” be placed into the file tags? Most of the time these are temporary holding places.

More power to you if you would like to `beet scrub` or whatever. My point is that the inverse can’t be done - you can’t pull original paths out of thin air years later. I continue to believe that making beets more lossless is a good goal for user-friendliness.

---

<div class="post-metadata">

**Author:** ![rik](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/rik/32/315_2.png) [@rik](https://discourse.beets.io/u/rik)\
**Post date:** [March 23, 2021, 10:46pm UTC](https://discourse.beets.io/t/should-we-start-recording-the-original-path-and-filename-on-import/1494/8 "2021-03-23T22:46:11Z")

</div>

coming to this thread late, but i don’t see a big upside to adding this meta data to every record. i use import scripts that bind particular directories and keep track of the sources that way, outside of beets.
