[09:32:38] [telegram] Hello, I need some help with Commons' API: [09:32:39] [telegram] I saw that there exist an aiprefix parameter, but how could I use regexps for my search? I would like to get the files matching a regexp of this type: foo.*bar.jpg [09:32:40] [telegram] Thank you! [13:21:49] [telegram] Hmm. when on a file page, is there no way to get the file size (in bytes) without an API call? i would expect it to be somewhere in mw.config or mw.mediaInfo, but i can't find anything [13:28:08] [telegram] in JS ? yeah not possible. you need to make an api call. basically by default mw.config contains as little as possible. it's expensive payload. [13:36:37] [telegram] ok, thanks. a "data-bytesize" (or something) attribute on the span.fileInfo element would have gone a long way though. Maybe I should file a task [13:39:12] [telegram] yeah, I was gonna say it's weird that the actual file size (in bytes) isn't available anywhere on the page or in the js [13:39:25] [telegram] Hmm [13:39:35] [telegram] Is it not? [13:39:40] [telegram] I can't find it at least [13:39:45] [telegram] [[File:Example.png]] [13:40:12] [telegram] https://tools-static.wmflabs.org/bridgebot/d09719f0/file_9741.jpg [13:40:21] [telegram] Not precise, but still [13:40:23] [telegram] exactly 2 kb? [13:40:41] [telegram] Nah, rounded up I assume [13:40:53] [telegram] so not the actual file size in bytes then [13:41:13] [telegram] Well it is. With certain precision. [13:42:39] [telegram] if you want to be pedantic: I find it weird that that the actual file size (in bytes with the exact number of bytes not rounded in any way) isn't available anywhere on the page or in the js [13:44:05] [telegram] now the same for https://www.mediawiki.org/wiki/File:Example.png?uselang=fa pls (re @Thecladis: [[File:Example.png]]) [13:44:35] [telegram] But what is weird in that? I can hardly imagine anyone needing that information (re @Nikki: if you want to be pedantic: I find it weird that that the actual file size (in bytes with the exact number of bytes not rounded in any way) isn't available anywhere on the page or in the js) [13:44:52] [telegram] i need it, that's why i'm asking 😜 (re @Thecladis: But what is weird in that? I can hardly imagine anyone needing that information) [13:45:30] [telegram] and an api call is not possible? (re @jhsoby: i need it, that's why i'm asking 😜) [13:45:55] [telegram] it is, but i'd rather not do one for every page load if i can avoid it (re @chicocvenancio: and an api call is not possible?) [13:46:17] [telegram] I guess. And some js to convert to arabic numerals : https://tools-static.wmflabs.org/bridgebot/db9ee466/file_9742.jpg [13:47:04] [telegram] I can see one api call for the page loads on your use case as a smaller penalty then sending it to everyone who might not need it (re @jhsoby: it is, but i'd rather not do one for every page load if i can avoid it) [13:47:12] [telegram] .. and finding the translations for KB, MB, GB in every language [13:47:19] [telegram] maybe you're not very imaginative then :P I can think of a bunch of things you might want to do. there was something I had been planning to do which would need the file size, I could also imagine people wanting to change the precision or way it's displayed [13:47:32] [telegram] 👍 (re @chicocvenancio: I can see one api call for the page loads on your use case as a smaller penalty then sending it to everyone who might not need it) [13:49:17] [telegram] I can't help but be amused at worrying about a few more bytes given the amount of stuff we already transfer to people on every page load whether it's useful or not [13:50:31] [telegram] But why? (re @jhsoby: .. and finding the translations for KB, MB, GB in every language) [13:50:54] [telegram] If you want to show some info to user then it is even better that it is already translated [13:51:04] [telegram] Although dunno what your actual usecase is :P [13:51:08] [telegram] that's not what i want to do (re @Thecladis: If you want to show some info to user then it is even better that it is already translated) [13:51:42] [telegram] i want to make a script that prompts you if you really want to go through with opening a file when its size is >1 GB (or whatever limit) [13:52:39] [telegram] Well then it is quite complicated because you also need to do that for the file history too [13:52:50] [telegram] Since ppl can click on some large version there [13:53:01] [telegram] While the current can be very small [13:53:26] [telegram] (Ad absurdum say if there was a movie inside old version of a small SVG) [13:53:53] [telegram] that ain't an argument against doing what Jon wants [13:54:02] [telegram] perfect is the enemy of good or whatever the saying it [13:54:03] [telegram] perfect is the enemy of good or whatever the saying is [13:54:09] [telegram] :) [13:55:12] [telegram] a warning that covers the majority of situations is better than not having a warning at all (and is in fact the same thing I wanted to do) [13:55:45] [telegram] situations isn't the right word but I can't think of what the right one would e [13:55:46] [telegram] situations isn't the right word but I can't think of what the right one would be [13:55:48] [telegram] /shrug [18:11:12] [telegram] @fuzheado you were looking forward to openrefine 3.5 in PAWS? Its here, since yesterday. (Servers that have been running for longer will to restart to see it) [18:44:34] @jhsoby: Adding a data attribute seems reasonable to me, did you end up filing a task? [18:52:54] [telegram] legoktm: i went the api route, but can file a task too [20:12:16] [telegram] Huzzah, thanks! (re @chicocvenancio: @fuzheado you were looking forward to openrefine 3.5 in PAWS? Its here, since yesterday. (Servers that have been running for longer will to restart to see it))