Skip to content

use res['title'] to as a new filename#82

Merged
nabobalis merged 6 commits intoHelioviewer-Project:mainfrom
akash5100:filename_tweaks
Oct 17, 2022
Merged

use res['title'] to as a new filename#82
nabobalis merged 6 commits intoHelioviewer-Project:mainfrom
akash5100:filename_tweaks

Conversation

@akash5100
Copy link
Collaborator

@akash5100 akash5100 self-assigned this Oct 1, 2022
@nabobalis
Copy link
Member

Do we need to be worried about the test failure or is it just a side effect of using the dev API?

Expected:
    'xml_header(\'<?xml version="1.0" encoding="utf-8"?><meta><fits><SIMPLE>1</SIMPLE><BITPIX>16</BITPIX>...')'
Got:
    '{"error":"Unable to process XML Header for \\/mnt\\/data\\/jp2\\/: Unable to locate image dimensions in header tags!","errno":13}'

@dgarciabriseno
Copy link
Collaborator

Do we need to be worried about the test failure or is it just a side effect of using the dev API?

Expected:
    'xml_header(\'<?xml version="1.0" encoding="utf-8"?><meta><fits><SIMPLE>1</SIMPLE><BITPIX>16</BITPIX>...')'
Got:
    '{"error":"Unable to process XML Header for \\/mnt\\/data\\/jp2\\/: Unable to locate image dimensions in header tags!","errno":13}'

That's beta being beta. The image with that ID was deleted. I put a new one there and modified it so it won't get deleted again. Rerunning the job, should pass now.

@nabobalis
Copy link
Member

There is now a windows failure:

    def _opener(self, name, flags, mode=0o666):
        # A stub for the opener argument to built-in open()
>       return self._accessor.open(self, flags, mode)
E       OSError: [Errno 22] Invalid argument: 'SDO AIA 171 (2022-09-22 17:52:21 - 17:56:33 UTC).mp4'

I wonder if we need to sanitize the title?

@akash5100
Copy link
Collaborator Author

There is now a windows failure:

    def _opener(self, name, flags, mode=0o666):
        # A stub for the opener argument to built-in open()
>       return self._accessor.open(self, flags, mode)
E       OSError: [Errno 22] Invalid argument: 'SDO AIA 171 (2022-09-22 17:52:21 - 17:56:33 UTC).mp4'

I wonder if we need to sanitize the title?

sanitize the title?

@nabobalis
Copy link
Member

Yes, I wonder if the windows error is due to the fact the filesystem does not support all of those characters.

If that is the case, the title needs to be cleaned of bad characters.

@nabobalis
Copy link
Member

You can do something like this:

import re
clean_filename = re.sub(r"[^\w\-_\. ]", "_", title)

@nabobalis
Copy link
Member

I am going to merge this and update the change and the other issue on a new PR

@nabobalis nabobalis merged commit 716a5ec into Helioviewer-Project:main Oct 17, 2022
@akash5100 akash5100 deleted the filename_tweaks branch October 18, 2022 06:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update default filename for createMovie and createScreenshot

3 participants