

| Sign in: |
| Members log in here with your user name and password to access the your admin page and other special features. |
|
|
|

|
|| SportsShooter.com: Member Message Board

Code Replacement files for Photo Mechanic #2
 
Mike Stone, Photographer
 |
Dallas | TX | USA | Posted: 2:58 PM on 05.10.06 |
->> This is a great feature and like others have said, it rocks that I found out about it through the SS forum.
I also apprecaite the discussion about a depository for the data files, however, I wonder, why recreate the wheel?
After I thought about this a little bit, I have written a script that will allow you to specify a couple of teams (home team, visiting team) and then to extract the rosters from espn.com.
This is strictly conceptual at this time but i thought i would throw it out here for feedback. Anyone may feel free to use it. the link is:
http://stopactionsports.com/extract.php
A few additional comments:
-right now it is just setup for mlb
-there is a pull down box to select two teams
-there is a "prefix" box for each team. this is so you can define the prefix. For instances, if you want to select Derek Jeter by type n2, simply set the prefix to 'n'. if you prefer nyy2, set the prefix to 'nyy'
-once you click the submit or create button, the date will be displayed in your browser. From here click FILE, SAVE AS and save it as a .txt file. from there of course, you will have to set photo mechanic to use it.
-i have done very MINIMAL testing with Firefox and IE, use at your own risk
I think that is it. Again, any comments or suggestions would be appreciated. |
|
 
Robert Deutsch, Photographer
 |
NY | NY | USA | Posted: 6:28 PM on 05.10.06 |
| ->> Mike, thats a great idea but it looks like it's not putting in tabs or returns, just spaces. I tried it on a pc and Mac, IE and Firefox.. |
|
 
Robert Deutsch, Photographer
 |
NY | NY | USA | Posted: 8:32 PM on 05.10.06 |
| ->> Mike, Kirk at Camerabits points out that the source code is fine. Its the "save as" that's the issue. In Firefox, you can't easily save the source at .txt without cut and paste, but in IE you can "View Source" and then save as a TXT file. That will work in PM. In Safari you can "save as", but it creates an .html file. You have to rename it to .txt |
|
 
Bob Levey, Photographer
 |
Richmond/Houston | TX | USA | Posted: 11:29 PM on 05.10.06 |
->> Thanks Mike.... works great in IE
Bob |
|
 
Greg Ferguson, Photographer
 |
Scottsdale | Az | USA | Posted: 12:08 AM on 05.11.06 |
->> Mike,
I checked the output file using Safari and some plugins I use for diagnosing web issues.
The problem is the http header being returned by PHP. PHP is assumin the file being returned is HTML and is returning a "Content-Type: text/html" header to the browser. The browser then displays the page as a web page, which gets wrapped because the line-ends are ignored, because that's what browsers do with HTML.
In your PHP source, you need to add an HTTP header() command to force a plain text file.
header("Content-Type: text/plain");
See the header() information in the docs for more info.
http://www.php.net/manual/en/ref.http.php |
|
 
Greg Ferguson, Photographer
 |
Scottsdale | Az | USA | Posted: 12:11 AM on 05.11.06 |
| ->> Or, you could wrap the output with "<pre>" and "</pre>" and a cut/paste would behave better. |
|
 
Mike Stone, Photographer
 |
Dallas | TX | USA | Posted: 8:26 AM on 05.11.06 |
->> Hey Guys,
Thank you for the feedback.
I should have clarified, everything I have done has been in the windows environment which probably explains why some of the things you all are experiencing are different from what I see.
Robert,
When the data is displayed on the browser it does appear to be without tabs and carriage returns. That is because the browser does not display the tab, and i removed the tag because the name would show up in PM as Derek Jeter. With Firefox 1.5.0.3, doing the "save file as" and selecting "text file" has produced a clean file. I cannot explain why you are seeing something differently. If you like, give me a call and maybe we can figure out what is going wrong.
Greg,
I have intentionally tried to remove all the header data. It didnt seem to cause a problem with Firefox, but for some reason when using IE, something about the way the file was saved prevented PM from loading it correctly. Perhaps you could email to me the view source file and I would be able to see the differences between your source and mine. When I do a view source, I actually get a "pretty" file where the tabs are in place and the columns are aligned and each player begins a new line. There is no header data displayed in the source.
Thanks again for your help and feedback.
I actually had a chance to use the code replacement feature in PM on an assignment under deadline last night. It was the FC Dallas/LA Galaxy soccer game and I am hooked. What a time saver!!! |
|
 
Primoz Jeroncic, Photographer
 |
Kranj | SI | Slovenia | Posted: 9:31 AM on 05.11.06 |
| ->> Maybe just a suggestion for this. I have php script on my web, which "forces" user to save jpeg file instead of showing it in browser, when they click download photo link. I can send you this php script if you would want, since I have feeling that a script which would be just a bit rebuild, and would produce text file, which user would save (without copy and paste) without displaying in browser, would minimize all these problems with one browsers working fine and other not. |
|
 
Mike Stone, Photographer
 |
Dallas | TX | USA | Posted: 10:20 AM on 05.11.06 |
->> Hey Primoz,
That would be great. I have felt that if this is something that proved useful, one of the first enhancements would be to design it so that it did create a downloadable file for exactly the reason you mention; to reduce the variables of different browsers, operating systems, etc. If you do not mind sharing, I would like to take a look at yours. |
|
 
Greg Ferguson, Photographer
 |
Scottsdale | Az | USA | Posted: 1:55 PM on 05.11.06 |
->> "I have intentionally tried to remove all the header data. It didnt seem to cause a problem with Firefox, but for some reason when using IE, something about the way the file was saved prevented PM from loading it correctly. Perhaps you could email to me the view source file and I would be able to see the differences between your source and mine. When I do a view source, I actually get a "pretty" file where the tabs are in place and the columns are aligned and each player begins a new line. There is no header data displayed in the source."
The difference between OS platforms and browsers will make the page display differently with different combinations of browsers and OSes. This is because the data isn't being sent correctly according to how web servers work and browsers react.
"View Source" shouldn't be necessary if the file is sent using the right content-type. Because PHP is assuming what is being sent is HTML, it's sending a *HTTP* (web server) header declaring the data being tranferred is "text/html". This is different than the *HTML* '<head>' block inside a web page, which IS being omitted by your PHP (along with all the other HTML tags).
The proper way to address this is for your PHP code to use the (HTTP function) 'header("Content-Type: text/plain")' to force the correct web-server header and send the text as is, in which case any browser will have the information to know the file is a regular text file and won't attempt to format it using the standard HTML rules if the browser is at all standards compliant.
Or, you can build a true HTML page to be returned and wrap the data in '<pre>'/'</pre>' blocks, in which case the browser will understand the data contained in that block is already formatted correctly, and it won't do the additional/unnecessary HTML formatting in the page when its rendered. Then, the user can just do a "select all", "copy" then paste, or a "Save As" and tell their browser to use a Text file format.
The "Show Source" step will be unnecessary at that point with either method.
What Primoz is proposing is an extension to the first method - only you want your code to return a "text/plain" object (using the header() function) instead of a graphic file. Your code will need to change from using a "Submit" button to an anchor that submits if you want to provide the filename to the user's browser.
This breaks easily though. Depending on how the user's browser is set up it might display the data on a new page, or it might pop-up a "Save File" dialog. That's determined by the user's browser's MIME-type settings and isn't really controllable from the PHP code unless you send a MIME-type ("Content-Type") that ALWAYS results in a file download, such as a .zip, .sit, or .gz file (and actually encode the data into that format before sending it.) You need to be aware of the various MIME types, and how the browser reacts to them to avoid confounding the user if you go down that path. This is a good starting point to learn more:
http://www.rfc-editor.org/rfc/rfc2046.txt |
|
 
Mike Stone, Photographer
 |
Dallas | TX | USA | Posted: 10:27 AM on 05.12.06 |
->> Greg thanks again for the advice and information. I have looked into what you suggest and will contact you offline to discuss so as not to bog the thread down with programming details.
If it proved there were value to this, I will invest the time to make it more useful and reliable; incorporating other leagues, adding the ability to include the players position and/or jersey number with the name so as to better fit the style of captioning required and just making it sound technically.
Thanks to all who have replied.
Mike |
|
 
Steve Russell, Photographer
 |
Toronto | ON | Canada | Posted: 8:36 PM on 05.18.06 |
->> Wow, code replacement!!!!
Very cool, I thought I was pretty special showing this off to our interns,
but, you know interns,....., always teaching staff something!!!
Well, one of our interns uses a program that code replaces
in any program you might have running, including Photo Mechanic.
Although there are some limits to it that make the PM version still useful.
(the PM version allows multiple codes that have the same beginning,
very useful for sports)
This program has some pluses,
it works in every program I tried and it allows for input of dates and times automatically.
The program is called textpander and can be found at:
http://www.petermaurer.de/nasi.php?section=textpander
Enjoy! |
|
 
Clark Brooks, Photo Editor, Photographer
 |
Urbana | IL | USA | Posted: 10:05 PM on 05.18.06 |
->> Steve:
I got all excited until I found out the textfinder only works on macs. > |
|
 
Mike Stone, Photographer
 |
Dallas | TX | USA | Posted: 1:56 PM on 05.21.06 |
->> I have made some changes to the script that extracts the MLB team data from the ESPN website:
1. Now saves the data in a file that can be downloaded (thank you Primoz for the script to do this).
2. Will include codes that have the players name preceeded by his position and/or team name.
For example, if you specify a prefix of 'nyy' for the Yankees, you will get the following results:
nyy2 will insert Derek Jeter
Preceed that with a 't' and it will include the team name:
tnyy2 will insert New York Yankees Derek Jeter
Preceed with a 'p' for position:
pnyy2 will insert shortstop Derek Jeter
And finally team and position can be included with 'tp':
tpnyy2 will insert New York Yankees shortstop Derek Jeter
Again, this was tested modestly in only a windows environment and using the latest versions of IE and Firefox.
Oh yeah, the link is:
http://stopactionsports.com/extract.php |
|
 
Clark Brooks, Photo Editor, Photographer
 |
Urbana | IL | USA | Posted: 5:14 PM on 05.21.06 |
| ->> Mike Stone, if I shot MLB, you would be my hero! Great idea for a way of adding letters for position and team name variables. |
|
 
Mark Goldman, Photographer
 |
Silver Spring | MD | USA | Posted: 9:35 PM on 06.15.06 |
| ->> This is an excellent tool and we should all get on our hands and knees and bow to Mike Stone. My friend Ed Wolfstein showed me how it works and it is pretty slick. I used it today for the Rockies drubbing of the Nationals and it decreased my captioning time by probably 30%. Thank Mike. |
|
 
Mike Stone, Photographer
 |
Dallas | TX | USA | Posted: 1:10 PM on 07.11.06 |
->> Thanks Mark and Clark, your words are way too kind!
I have had several ask if I would enhance the script to include more then MLB. I will and I have...I implemented the NFL this morning and will do the NBA and NHL once the seasons get a little closer.
I appreciate all of those who have provided feedback and suggestions. If there are other enhancements you would like to see, let me know.
Based on the website traffic, it appears there is some pretty consistent use of the script. That is gratifying.
Thanks,
Mike |
|
 
Delane B. Rouse, Photographer, Photo Editor
 |
Washington | DC | US | Posted: 1:56 PM on 07.11.06 |
| ->> Hey Mike...you're the man!!!! Thanks!!! |
|
 
Andy Altenburger, Photographer
 |
Tiffin | OH | USA | Posted: 8:04 PM on 07.11.06 |
| ->> Mike, any chance of extending this beyond MLB? |
|
 
Delane B. Rouse, Photographer, Photo Editor
 |
Washington | DC | US | Posted: 8:06 PM on 07.11.06 |
->> Andy...
Mike said:
"I have had several ask if I would enhance the script to include more then MLB. I will and I have...I implemented the NFL this morning and will do the NBA and NHL once the seasons get a little closer." |
|
 
Frank Victores, Photographer
 |
Ft Thomas | KY | USA | Posted: 10:32 PM on 08.29.06 |
->> Guys,
I need to add the players number.
Cincinnati Reds pitcher (61) Bronson Arroyo.
I can't get the number to show up.
I tried to change the txt file several different ways but nada.
Any ideas ?
Thanks,
fv |
|
 
Mike Stone, Photographer
 |
Dallas | TX | USA | Posted: 12:54 PM on 08.30.06 |
->> I have considered adding this option to the code files the script creates, but the question comes up of where and how to insert the information. One client I have prefers the number, preceeded with a pound sign, to follow the name. In Frank's example above, its in parentheses preceeding the name.
I am curious what format others require. Anyone care to comment? |
|
 
Warren Wimmer, Photographer
 |
Orland Park | Il | USA | Posted: 4:30 PM on 10.25.07 |
| ->> Mike, it would be great if you could colorabate with the folks at photo mechanic to get the code replacement to work in the "photo renaming string" when using the mac version. I understand that it will work on the PC platform now. |
|
 
Paul W Gillespie, Photographer
 |
Annapolis | MD | USA | Posted: 5:07 PM on 10.25.07 |
->> Mike,
Since this thread has resurfaced, I just wanted to take the time to thank you for your site. It saves me lots of time at games.
Paul |
|
 
Mike Stone, Photographer
 |
Dallas | TX | USA | Posted: 6:17 PM on 10.25.07 |
->> Thank you for the comments Paul!
Warren, this doesnt really have anything to do with the code files themselves but whether or not Camera Bits choses to implement the feature on a Mac platform. They seem to be responsive to their customers so i would encourage you to make the request directly to them. If they were to decide it was worthwhile, I can assure you they will not need my help. :)
Mike |
|
 
Max Simbron, Photographer, Assistant
 |
Phoenix | AZ | USA | Posted: 6:23 PM on 10.25.07 |
->> Mike,
I'd also like to thank you. Code replacements got me through the NFL season, and some college football. Without you, I'd be scrambling to type out names off of roster sheets.
Max |
|
 
Brian Hill, Photographer
 |
Lisle | IL | USA | Posted: 9:21 PM on 10.25.07 |
->> Mike,
I am with everyone else on this. Thanks a BUNCH, you rock for putting this together. I can not tell you how many more images I have been able to file on deadline using the txt file from your site.
Thanks again.
Brian |
|
 
Warren Wimmer, Photographer
 |
Orland Park | Il | USA | Posted: 9:22 PM on 10.25.07 |
->> Mike
I will also chime in and thank you for your past work. After Dennis W turned me on to your site it has been a blessing.
As a side bar should you have a pay pal site I would be more than happy to help with it's growth to show my appriciation |
|
 
Louis Lopez, Photographer
 |
Fontana | CA | USA | Posted: 10:21 PM on 10.25.07 |
->> Mike,
you have done a great service with your site and offering code replacement files to us working professionals at no cost. You are truly giving back by easing the workload on us in the field. A great many thanks to you.
If you are ever out our way, drinks are on me.
Thanks again.
-Louis |
|
 
Jim Cowsert, Photographer
 |
Grapevine | TX | USA | Posted: 11:53 PM on 10.25.07 |
->> Mike,
Ditto what everyone else has said. It really got me through my first season shooting MLB. My first game took me over 4 hours to caption before SS member Jeff Etessam showed me how to do this with your site. Soon I was out of the stadium within a hour after the game with no caption mistakes.
Thanks again for all your help with this and being my sponsor here. Hope to see you soon on the sidelines.
Jim C. |
|
 
Bill Vaughn, Photographer
 |
Huntsville | Al | United States | Posted: 8:51 AM on 10.26.07 |
->> Thanks Mike. Appreciate your work to make our jobs easier. I just found this and can't wait to use it this weekend. Am I missing something with the NFL option? It only returns the team names, no roster. MLB is working fine. I tried FireFox and Safari.
Thanks Again,
Bill |
|
 
Dennis Wierzbicki, Photographer
 |
Plainfield | IL | USA | Posted: 10:42 AM on 10.26.07 |
->> Mike,
Your site is unbelievably helpful and I'll add my voice to the growing chorus of THANK YOU's !!!
Warren, I second Mike's comment on CameraBits' responsiveness. A couple months ago I asked them about being able to sort based on aspect ratio (important for a resizing action I use in PhotoShop) and two days later, a new version of PM was released that included the feature I requested. Amazing.
Bill, I use Mike's site with Safari 3.0.3 under Mac OS 10.4.10 and it works fine. Maybe you're selecting different options? |
|
 
Andrew Dolph, Photographer
 |
Medina | OH | USA | Posted: 7:25 PM on 10.31.07 |
->> I'm using PM 4.5.2 and don't see the "Code Replacement" button anywhere in preferences. Am I missing something? What's more, when I generate the code file from Mike Stone's website, it only shows the two teams I've selected. What am I doing wrong?
Can anyone help me out?
Thanks!
— Andrew
PS: I'm referencing this: http://camerabits.fileburst.com/Photo%20Mechanic%204%20Manual.pdf
(Page 28) |
|
 
Scott A. Schneider, Photographer
 |
Minneapolis | MN | USA | Posted: 7:43 PM on 10.31.07 |
| ->> edit, preferences, iptc, code replacement, add; I think you might have to download a couple of teams at a time |
|
 
Craig Mitchelldyer, Photographer, Assistant
 |
Portland | OR | USA | Posted: 7:49 PM on 10.31.07 |
| ->> Andrew, in 4.5.2 it is under the edit menu. I had the same issue the other day. the option was moved in 4.5 |
|
 
Dennis Wierzbicki, Photographer
 |
Plainfield | IL | USA | Posted: 9:38 PM on 10.31.07 |
->> Andrew,
"when I generate the code file from Mike Stone's website, it only shows the two teams I've selected. What am I doing wrong? "
Since usually only two teams are involved in any given game, this is normally enough. I'd suggest downloading and inputing a new roster for each game, even if you already have one for a specific team, 'cuz rosters can and do change.
If you want to do an entire league, you could start off with two teams, and generate additional pairs of teams, then cut and paste the additional teams into the original document.
Occasionally, people will post entire leagues' worth of Code Replacements on the CameraBits forum, but since Mike made up his applet, most people just generate them right before a game. |
|
 
Chad Ryan, Photographer, Assistant
 |
Fort Wayne | IN | USA | Posted: 11:24 PM on 10.31.07 |
->> I'm having the same problem Bill Vaugh is experiencing. I input the prefixes for both teams as I have done several times, and only the team names are showing up on the download. No roster at all. I have used this site several times, but this is the first time I've experienced any problems. I'm trying to get the code-replacement file for the Indianapolis Colt/New England Patriots game. I used the prefix "i" for the Colts and "p" for the Patriots. On the downloaded file, all I get (three times now) is:
i Indianapolis Colts
p New England Patriots
... and that's it.
Am I doing something wrong that I haven't done before, or has something changed with the site?
Thanks for any help anyone might be willing to dish out. |
|
 
Carl Auer, Photographer
 |
Eagle River | AK | USA | Posted: 11:43 PM on 10.31.07 |
| ->> Are there any other code replacement file makers out there? NCAA hoops and hockey would be a life saver for me…. I would love to make my own extractor, but have no clue how to start.... |
|
 
Andrew Dolph, Photographer
 |
Medina | OH | USA | Posted: 4:11 AM on 11.01.07 |
->> Dennis,
Sorry my issue wasn't clearer. See Chad's post ... We're experiencing the same issue: Names of teams exist, but no roster itself.
Perhaps I should generate my own? |
|
 
Dennis Wierzbicki, Photographer
 |
Plainfield | IL | USA | Posted: 8:45 AM on 11.01.07 |
->> Andrew (and Chad, et al)
NOW I see what you mean. I just tried it myself and got the same thing. I'm guessing it's something that has changed on ESPN.com's site, as this is where the applet goes to get rosters.
The rosters are still on ESPN's site:
http://sports.espn.go.com/nfl/teams/roster?team=nwe
but maybe where they're located, or how they're displayed is different?
I just contacted Mike contacted and we'll see what's up. |
|
 
Dennis Wierzbicki, Photographer
 |
Plainfield | IL | USA | Posted: 10:56 AM on 11.01.07 |
| ->> Here's an update:maybe the problem is with the NFL rosters, as I just did one for an upcoming NHL game and that worked fine. |
|
 
Mike Stone, Photographer
 |
Dallas | TX | USA | Posted: 8:09 PM on 11.01.07 |
->> Hey Guys,
Wouldn't you know it, a bunch of nice things were said about the scripts and then they go and break. As most of you know, the data for the scripts come from espn.com. My website simply reads the pages on epsn.com and then scraps the pertinent data from their page and creates the text files that are downloaded. This works great until ESPN decides to change the format of the page and then my scripts get all confused. ESPN did exactly that and hence the problems.
I think I have it fixed now though. As always, I have a policy of spending no more then 10 minutes testing anything I write so USE AT YOUR OWN RISK! :) Seriously, you should always verify the code files with the rosters you pick up at the game.
Thanks to Steve, Dennis and Drew for the heads up.
Cheers,
Mike |
|
 
Dennis Wierzbicki, Photographer
 |
Plainfield | IL | USA | Posted: 9:54 PM on 11.01.07 |
->> Mike,
Thanks for taking care of this. Just worked fine on Mac OS 10.4.10, Safari 3.0.3 with the Colts and Patriots. |
|
 
Bill Vaughn, Photographer
 |
Huntsville | Al | United States | Posted: 10:18 PM on 11.01.07 |
| ->> Thank you so much Mike. Can't wait to try this out! |
|
 
Chad Ryan, Photographer, Assistant
 |
Fort Wayne | IN | USA | Posted: 11:15 PM on 11.01.07 |
->> Mike,
You're a lifesaver ... well, maybe a saver of a good half hour or more at each game. But seriously, thank you for your wonderful application. BTW, I do check the file with the game roster and haven't encountered any problems just yet.
Thanks again! |
|
 
Larz Schwartz, Photographer
 |
Chandler | AZ | USA | Posted: 1:59 AM on 01.19.09 |
->> Hi, I tried this and it doesn't appear to be working.
I know this is an old thread, but I was looking for a way to speed up doing captions.
Is there a new link for this to work? I am on a Mac, OSX using PM.
Will it work for college sports as well as ECHL Hockey?
Thanks Larz |
|
 
Louis Lopez, Photographer
|
 
Larz Schwartz, Photographer
 |
Chandler | AZ | USA | Posted: 2:48 AM on 01.19.09 |
| ->> Thanks Louis! |
|
 
Robert Hanashiro, Photographer
 |
Los Angeles | CA | | Posted: 2:51 AM on 01.19.09 |
->> From the Sports Shooter Newsletter Archives:
http://www.sportsshooter.com/news/1951
ALSO ... This is something that you probably should use a cool feature on the site, the Equipment Q & A. Posing your question via this ss.com feature funnels it directly to people that use, in this case, Photo Mechanic.
Mahalo! |
|
 
Larz Schwartz, Photographer
 |
Chandler | AZ | USA | Posted: 12:05 PM on 01.19.09 |
->> Good idea Robert!
I have only been on the site a short time and forgot about that.
Thanks Larz |
|

This thread has reached the maximum number of posts If you would like to continue it, please create a new thread. [ Create new thread? ]

Return to --> Message Board Main Index
|