mediathekviewweb icon indicating copy to clipboard operation
mediathekviewweb copied to clipboard

Use at least the title shown on left side (maybe via DOM) for a better filename when saving..

Open bufemc opened this issue 6 years ago • 3 comments

I've read the notes under: https://github.com/mediathekview/mediathekviewweb/issues/19

However, isn't it possible just to re-use the title shown on the left side (maybe via DOM) at least to give the file a meaningful name when saving it?

Example: Tatort: Murot und das Murmeltier

will be saved just as: 1280-1_357141.mp4

I think we all agree that a harddisk full of files named like this are quite a puzzle ;-)

Proposal, should be possible maybe by accessing DOM elements?:

  1. take/retrieve/transport the name shown on left side (via DOM?)
  2. replace illegal characters, like ":" with "-", " -" or "", result could be something like: Tatort - Murot und das Murmeltier - 1280-1_357141.mp4

bufemc avatar Feb 20 '19 07:02 bufemc

And how should we rename a file which isn‘t on our servers? I think you got that wrong, we have access to the metadata like the Title but not the video files. The video files are only on the servers of the Öffentlich Rechtliche and their Mediatheken.

Nicklas2751 avatar Feb 20 '19 10:02 Nicklas2751

You can actually download a file and replace the original name with something else via javascript. I once did this for a project. The code looked like this:

axios({
  url: 'http://exampleurl.com/file',
  method: 'GET',
  responseType: 'blob', // important
}).then((response) => {

  const url = window.URL.createObjectURL(new Blob([response.data], {type:'application/vnd.ms-excel'}));
  const link = document.createElement('a');

  link.href = url;
  link.setAttribute('download', 'NewFileName.xls');
  document.body.appendChild(link);
  link.click();
});

I used axios but it should also work with your run-of-the-mill XHR Request or whichever fetching mechanism you guys use. The important part is in the promise.

G710 avatar May 16 '19 19:05 G710

I've had a similar idea for converting HLS streams into useful files. Great idea to use that for normal downloads too, thank you!

bagbag avatar May 16 '19 20:05 bagbag